mirror of
https://github.com/Comfy-Org/comfy-python-sdk.git
synced 2026-11-04 23:37:47 +00:00
[PR #22] [MERGED] test: SSE conformance leg for the gateway e2e suite (+ graceful 501 degradation) #29
Labels
No labels
audit:ai-readiness
audit:community
audit:github
audit:health-scoring
audit:policy
audit:release
audit:supply-chain
effort:medium
effort:small
effort:small
effort:trivial
priority:nice-to-have
priority:nice-to-have
priority:recommended
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-python-sdk#29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-python-sdk/pull/22
Author: @sundar-svg
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/30/2026
Merged by: @wei-hai
Base:
main← Head:sundar/sse-conformance-leg📝 Commits (2)
308330ctest: SSE conformance leg for the gateway e2e suiteb77aef5feat: events() degrades gracefully when the events endpoint is 501📊 Changes
4 files changed (+121 additions, -2 deletions)
View changed files
📝
src/comfy_sdk/jobs.py(+13 -0)📝
tests/conftest.py(+5 -0)📝
tests/integration/test_gateway_e2e.py(+61 -1)📝
tests/test_events.py(+42 -1)📄 Description
Description
The platform-gateway now implements
GET /jobs/{id}/events(SSE v1:statussnapshot/change frames,outputframes, 15s keepalives). This turns the manual staging smoke into a repeatable, env-gated conformance test, and pins the SDK's behavior when a surface answers the events endpoint with 501.Commit 1 — conformance leg + behavior pins
test_stream_delivers_lifecyclein the env-gated gateway e2e suite: submits the model-free workflow and consumesjob.events()under a daemon-thread watchdog (120s hard cap, so a wedged stream fails instead of hanging CI). Asserts: aStatusChangesnapshot arrives promptly after connect (generous 30s bound; ~0.4s observed live), anOutputReadyarrives before the terminal frame, iteration ends on its own at a terminalStatusChange(succeeded), andjob.refresh()agrees. Duplicate frames are tolerated (snapshot semantics — no counts asserted).events_not_implementedmode (501 +not_implementedErrorEnvelope) and the then-current behavior was pinned:events()raised the protocol-levelcomfy_low.errors.ApiError.StatusChange, no reconnect (clean-end/poll-running and idle-timeout/poll-terminal were already covered).Commit 2 — graceful 501 degradation
events()iteration silently (yield nothing) instead of raising, sync and async. Rationale: the spec declares 501 contract-legal for surfaces without SSE, and the SDK is poll-first with SSE as enhancement —wait()/result()remain fully functional, so a hard raise punished users for a server's legal choice. Any otherApiErrorfrom the stream still raises. Pin tests updated (old expectation documented in the docstring), including assertingwait()still completes and that there is no reconnect loop on 501.How tested
uv run pytest: 105 passed, 4 skipped — the 4 skips are the integration leg withoutCOMFY_BASE_URL/COMFY_API_KEY, proving the gating works.uv run ruff check/ruff format --check/mypy src: clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01M2mBv9d3kfp7SmZ9uMc4tR
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.