Skip to content

chore: sync the v2 spec and wire every operation it declares - #49

Merged
wei-hai merged 9 commits into
mainfrom
wei/sync-v2-spec-complete
Aug 13, 2026
Merged

chore: sync the v2 spec and wire every operation it declares#49
wei-hai merged 9 commits into
mainfrom
wei/sync-v2-spec-complete

Conversation

@wei-hai

@wei-hai wei-hai commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Brings the vendored Comfy API v2 spec up to date and leaves CI green, which the automated sync PR can't do alone: tests/test_spec_coverage.py asserts OPERATION_IDS matches the spec exactly, so a sync that introduces operations without wrappers always fails.

The synced spec introduces two: getJobWorkflow and deleteAsset. Both are implemented here.

What's in it

  • Vendored spec synced from the canonical contract (cloud@7c65b1a), plus regenerated models
  • get_workflow() on Job/AsyncJob — returns the graph and a format discriminator (save = the authoring workflow at the version the job ran; api = the executed graph). Callers must branch on it: which shape comes back depends on how the job was submitted, not on anything the caller controls
  • Asset deletionAsset.delete() and assets.delete(id)
  • Both registered in OPERATION_IDS/OPERATION_METHODS, with get_job_workflow moved onto the generated JobWorkflowResponse model

Credit and supersession

The asset-deletion work is @jab416171's, from #41 — merged here with their commits intact rather than reimplemented, because the spec sync can't go green without it. That PR is superseded by this one; the implementation and tests are theirs.

Their branch had hand-edited spec/openapi.yaml to add deleteAsset before the sync existed. The canonical projection now declares it properly, so the synced file won that conflict — no behaviour change.

One real bug fixed along the way

Six delete-asset tests still called Comfy(server.base_url) positionally. That constructor argument was removed by the separately-merged COMFY_BASE_URL change, so the two branches were mutually stale — neither PR was wrong alone. Updated to Comfy() with the fixture's env var, matching every other test in those files. No test intent, assertions, or delete logic touched.

Verification

ruff, ruff format, mypy, drift, hygiene, and build+twine check all clean; 137 passed, 4 skipped (the skips need a live deployment, as in CI). test_spec_coverage.py passes all four assertions — all 11 spec operations have wrappers on both the sync and async transports.

TypeScript counterpart: Comfy-Org/comfy-typescript-sdk#49.

🤖 Generated with Claude Code

jab416171 and others added 9 commits August 7, 2026 16:25
A caller holding a job — including one rehydrated by id — had no way to see
the workflow behind it. The SDK holds the graph only when it submitted the
job in the same process; otherwise it is gone.

Calls GET /api/v2/jobs/{id}/workflow and returns both the graph and the
format discriminator. "api" is the executed graph, with editor-only
constructs already resolved away; "save" is the authoring workflow at the
version the job ran. Returning the discriminator matters: a caller must be
able to tell which shape it holds.

Written by hand rather than through the generated client, because the
vendored spec does not describe this endpoint yet. It moves onto the
generated client once the spec re-syncs.

Named to match the existing get_download_url(), and mirrored as getWorkflow()
in the TypeScript SDK.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The required post-sync step: scripts/gen_models.sh against the newly vendored
spec, so the drift gate passes. Picks up JobWorkflowResponse and the new
job_id/expires_at fields on Asset and Output.

Coverage still fails until the two new operations have transport wrappers —
getJobWorkflow (#47) and deleteAsset (#41) — since OPERATION_IDS must match
the spec exactly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Registers getJobWorkflow and deleteAsset in OPERATION_IDS/OPERATION_METHODS,
moves get_job_workflow onto the generated JobWorkflowResponse model, and
fixes six delete-asset test call sites that still passed the base URL
positionally after that constructor argument was replaced by COMFY_BASE_URL.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wei-hai
wei-hai requested review from a team as code owners August 13, 2026 17:50
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@wei-hai, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ae5efbd7-8a19-493e-87d5-877004c8b434

📥 Commits

Reviewing files that changed from the base of the PR and between 8bfbd3c and 47c46d2.

📒 Files selected for processing (12)
  • spec/openapi.yaml
  • src/comfy_low/__init__.py
  • src/comfy_low/models/__init__.py
  • src/comfy_low/models/_generated.py
  • src/comfy_low/transport.py
  • src/comfy_sdk/__init__.py
  • src/comfy_sdk/assets.py
  • src/comfy_sdk/jobs.py
  • tests/conftest.py
  • tests/test_assets.py
  • tests/test_async.py
  • tests/test_job_workflow.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wei-hai
wei-hai merged commit a60d598 into main Aug 13, 2026
11 checks passed
@wei-hai
wei-hai deleted the wei/sync-v2-spec-complete branch August 13, 2026 17:53
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants