[PR #17] [MERGED] feat(cancel): migrate job cancel onto POST /api/jobs/{job_id}/cancel #19

Closed
opened 2026-10-26 22:33:59 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-swift-sdk/pull/17
Author: @mattmillerai
Created: 6/21/2026
Status: ✅ Merged
Merged: 6/21/2026
Merged by: @mattmillerai

Base: main ← Head: feat/cancel-jobs-api-migration


📝 Commits (2)

  • ab7274d feat(cancel): migrate job cancel onto POST /api/jobs/{job_id}/cancel
  • e5d4e19 test(cancel): add live cancel round-trip smoke test (verified against staging)

📊 Changes

4 files changed (+88 additions, -23 deletions)

View changed files

📝 Scripts/contract/sdk-endpoints.yml (+2 -5)
📝 Sources/ComfySwiftSDK/Internal/Transport.swift (+1 -6)
➕ Tests/ComfySwiftSDKTests/JobCancelEndpointTests.swift (+44 -0)
📝 Tests/ComfySwiftSDKTests/SmokeIntegrationTests.swift (+41 -12)

📄 Description

Closes #12 — the last endpoint the contract drift check still flagged.

Migrates Transport.cancelJob off the deprecated POST /api/queue {"delete":[id]} onto POST /api/jobs/{job_id}/cancel. Both cancel callers (PollingFallback, WebSocketSession) route through this one method, so it's a single-site change.

Changes

  • Transport.cancelJob → POST /api/jobs/{job_id}/cancel (prompt_id == job_id, so JobHandle.id is already the path param). No request body; cancel stays best-effort/fire-and-forget and still yields .cancelled regardless of the { "cancelled": boolean } response.
  • JobCancelEndpointTests — new coverage asserting the cancel posts to /api/jobs/{job_id}/cancel (the cancel path previously had no test).
  • Scripts/contract/sdk-endpoints.yml — moved the entry onto /api/jobs/{job_id}/cancel.

Verification

  • swift build clean
  • swift test --no-parallel — 144 tests pass (+1)
  • Contract check vs. ComfyUI master: 6 ok, 0 warnings, 0 errors (was 1 warning)

Why draft

The unit suite proves the SDK calls the right endpoint, but not that the real cancel round-trips on the backend. Gate before merge: a staging smoke test against cloud.comfy.org confirming a real submit → cancel. Mark ready once that's green.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-swift-sdk/pull/17 **Author:** [@mattmillerai](https://github.com/mattmillerai) **Created:** 6/21/2026 **Status:** ✅ Merged **Merged:** 6/21/2026 **Merged by:** [@mattmillerai](https://github.com/mattmillerai) **Base:** `main` ← **Head:** `feat/cancel-jobs-api-migration` --- ### 📝 Commits (2) - [`ab7274d`](https://github.com/Comfy-Org/comfy-swift-sdk/commit/ab7274dd47b36e46e423bbfcc92fdbb4b4b305f8) feat(cancel): migrate job cancel onto POST /api/jobs/{job_id}/cancel - [`e5d4e19`](https://github.com/Comfy-Org/comfy-swift-sdk/commit/e5d4e19f402d79606d4360b380600b0532857afe) test(cancel): add live cancel round-trip smoke test (verified against staging) ### 📊 Changes **4 files changed** (+88 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `Scripts/contract/sdk-endpoints.yml` (+2 -5) 📝 `Sources/ComfySwiftSDK/Internal/Transport.swift` (+1 -6) ➕ `Tests/ComfySwiftSDKTests/JobCancelEndpointTests.swift` (+44 -0) 📝 `Tests/ComfySwiftSDKTests/SmokeIntegrationTests.swift` (+41 -12) </details> ### 📄 Description Closes #12 — the last endpoint the contract drift check still flagged. Migrates `Transport.cancelJob` off the **deprecated** `POST /api/queue {"delete":[id]}` onto `POST /api/jobs/{job_id}/cancel`. Both cancel callers (`PollingFallback`, `WebSocketSession`) route through this one method, so it's a single-site change. ### Changes - **`Transport.cancelJob`** → `POST /api/jobs/{job_id}/cancel` (`prompt_id` == `job_id`, so `JobHandle.id` is already the path param). No request body; cancel stays best-effort/fire-and-forget and still yields `.cancelled` regardless of the `{ "cancelled": boolean }` response. - **`JobCancelEndpointTests`** — new coverage asserting the cancel posts to `/api/jobs/{job_id}/cancel` (the cancel path previously had no test). - **`Scripts/contract/sdk-endpoints.yml`** — moved the entry onto `/api/jobs/{job_id}/cancel`. ### Verification - `swift build` clean - `swift test --no-parallel` — **144 tests** pass (+1) - Contract check vs. ComfyUI `master`: **6 ok, 0 warnings, 0 errors** (was 1 warning) ### Why draft The unit suite proves the SDK calls the right endpoint, but not that the real cancel round-trips on the backend. **Gate before merge:** a staging smoke test against `cloud.comfy.org` confirming a real submit → cancel. Mark ready once that's green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:33:59 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-swift-sdk#19
No description provided.