Skip to content

feat: add asset delete - #41

Open
jab416171 wants to merge 3 commits into
Comfy-Org:mainfrom
jab416171:main
Open

feat: add asset delete#41
jab416171 wants to merge 3 commits into
Comfy-Org:mainfrom
jab416171:main

Conversation

@jab416171

@jab416171 jab416171 commented Aug 7, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features

    • Added synchronous and asynchronous asset deletion by ID.
    • Added deletion support for committed asset instances.
    • Asset instances clear their stored ID after successful deletion.
    • Uncommitted assets cannot be deleted and raise an error.
  • Bug Fixes

    • API deletion failures now return consistent parsed errors.
  • Tests

    • Added coverage for synchronous and asynchronous deletion scenarios.

@jab416171
jab416171 requested review from a team as code owners August 7, 2026 22:26
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged.
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 6 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: 19a89d96-987c-4795-9c5b-9dcd2ad65827

📥 Commits

Reviewing files that changed from the base of the PR and between 3c2b9e2 and 7de4ad0.

📒 Files selected for processing (4)
  • spec/openapi.yaml
  • tests/conftest.py
  • tests/test_assets.py
  • tests/test_async.py
📝 Walkthrough

Walkthrough

Asset deletion is now available through synchronous and asynchronous low-level clients, asset handles, and asset factories. Committed asset handles clear their stored IDs after successful deletion. Tests cover request handling, deletion counts, state clearing, and uncommitted assets.

Changes

Asset deletion

Layer / File(s) Summary
Low-level deletion requests
src/comfy_low/transport.py
Synchronous and asynchronous clients send DELETE /assets/{asset_id} requests and accept only HTTP 204 responses.
SDK deletion behavior
src/comfy_sdk/assets.py
Asset handles and factories support synchronous and asynchronous deletion. Uncommitted handles raise RuntimeError; successful handle deletion clears the stored asset ID. Client errors are translated.
Deletion fixture and coverage
tests/conftest.py, tests/test_assets.py, tests/test_async.py
The test server handles authenticated deletion requests and counts valid deletions. Tests cover direct deletion, committed handles, ID clearing, and uncommitted handles.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AssetHandle
  participant SDKClient
  participant ComfyLow
  participant AssetAPI
  AssetHandle->>SDKClient: Delete committed asset
  SDKClient->>ComfyLow: Send DELETE request
  ComfyLow->>AssetAPI: DELETE /assets/{asset_id}
  AssetAPI-->>ComfyLow: Return HTTP 204
  ComfyLow-->>SDKClient: Return success
  SDKClient-->>AssetHandle: Clear stored asset ID
Loading

Suggested reviewers: wei-hai, sundar-svg

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding asset deletion APIs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@jab416171

Copy link
Copy Markdown
Author

I have read and agree to the Contributor License Agreement

comfy-legal added a commit to Comfy-Org/comfy-cla that referenced this pull request Aug 7, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@src/comfy_low/transport.py`:
- Around line 344-348: Update the `/api/v2/assets/{id}` definition in
`spec/openapi.yaml` to add a `deleteAsset` DELETE operation with the appropriate
success `204` response and existing error responses, then regenerate the OpenAPI
bindings so synchronous and asynchronous `delete_asset` remain contract-aligned.

In `@tests/conftest.py`:
- Around line 178-188: The test server’s do_DELETE method must model resource
removal instead of only counting requests. Capture the matched asset ID in the
server’s deleted-resource state, make the existing metadata and content GET
handlers return the API’s 404 for deleted IDs, and update both synchronous and
asynchronous instance tests to verify subsequent requests for that ID receive
404 responses.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 61042060-7667-4c9c-bf17-ec7492f06cdb

📥 Commits

Reviewing files that changed from the base of the PR and between cd90a51 and 3c2b9e2.

📒 Files selected for processing (5)
  • src/comfy_low/transport.py
  • src/comfy_sdk/assets.py
  • tests/conftest.py
  • tests/test_assets.py
  • tests/test_async.py

Comment thread src/comfy_low/transport.py
Comment thread tests/conftest.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant