mirror of
https://github.com/Comfy-Org/comfy-swift-sdk.git
synced 2026-11-04 23:47:26 +00:00
[PR #42] [MERGED] docs(polling): document why deriveFraction intentionally returns 0.0 (BE-2858) #44
Labels
No labels
enhancement
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-swift-sdk#44
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-swift-sdk/pull/42
Author: @mattmillerai
Created: 7/11/2026
Status: ✅ Merged
Merged: 7/16/2026
Merged by: @mattmillerai
Base:
main← Head:matt/be-2858-derivefraction-doc📝 Commits (1)
7ee38eedocs(polling): document why deriveFraction intentionally returns 0.0 (BE-2858)📊 Changes
1 file changed (+10 additions, -0 deletions)
View changed files
📝
Sources/ComfySwiftSDK/Internal/PollingFallback.swift(+10 -0)📄 Description
ELI-5
When a job is running, the SDK likes to tell you how far along it is — a fraction from 0 to 1. That number is only ever reported by the live WebSocket
progressframe. The REST "job status" endpoint the SDK polls (and reattaches to) simply doesn't include a progress number, so the helper that would compute one,deriveFraction(from:), just returns0.0.At a glance that looks like an unfinished stub someone forgot to fill in. It isn't — there's genuinely no field to derive a fraction from on that response. This PR adds a doc comment saying exactly that, so the next reader doesn't "fix" a
0.0that's intentional.What changed
PollingFallback.deriveFraction(from:)explaining thatJobDetailResponse(the jobs REST DTO) carries no numeric progress signal — onlystatus/outputs/executionError/ timestamps — so0.0is the intentional, honest value on the polling and reattach paths. A real fraction exists only on the live WebSocketprogressframe (value / max, seeWebSocketSession).No behavior change. This is a clarity-only fix.
Why not more
Per the grooming verdict on this ticket (downgraded from "implement it"), the honest minimal fix is a doc comment, not a refactor:
JobDetailResponsehas no progress field to derive from (verified: it decodes onlyid,status,outputs,execution_error,create_time,update_time).0.0— that's optional churn with identical behavior; keeping the named function + comment documents the intent at the call sites.Testing
swift build— clean.swift test --no-parallel).Notes / judgment calls
fraction != lastFractionhalf ofrunPollLoop's change-detection guard (fraction is always0from this source, so only the phase half ever fires) and thatReattachCoordinatoremits a single0.0progress. Both are documented as intentional rather than changed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.