mirror of
https://github.com/Comfy-Org/comfy-swift-sdk.git
synced 2026-11-04 23:47:26 +00:00
[PR #4] [CLOSED] feat(logging): add credential-free os.Logger error logging at SDK catch sites #9
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#9
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/4
Author: @mattmillerai
Created: 6/19/2026
Status: ❌ Closed
Base:
matt/be-1606-comfy-ios-backgrounded-fast-job-recovers-but-the-output← Head:matt/be-1608-comfyswiftsdk-add-minimal-error-logging-at-the📝 Commits (1)
d765c2afeat(logging): add credential-free os.Logger error logging at SDK catch sites📊 Changes
5 files changed (+521 additions, -15 deletions)
View changed files
📝
Sources/ComfySwiftSDK/Internal/PollingFallback.swift(+12 -4)➕
Sources/ComfySwiftSDK/Internal/SDKLog.swift(+214 -0)📝
Sources/ComfySwiftSDK/Internal/Transport.swift(+14 -8)📝
Sources/ComfySwiftSDK/Internal/WebSocketSession.swift(+11 -3)➕
Tests/ComfySwiftSDKTests/LoggingPrivacyTests.swift(+270 -0)📄 Description
ELI5
The SDK previously logged nothing, so when a job failed on-device the only visible clue was the final
ComfyErrorthrown to the caller — with no indication of which internal step failed or what the transport saw. This PR adds.error-level Console logs at the failure points (output-build catch, WebSocket read-loop error,execution_errorframe, polling give-up, output-assembly failure) so the next bug is self-diagnosing. Logged fields are strictly classification-only —ComfyErrorcase name, POSIX code for socket-drop paths, andjobId— never the API key, OAuth token,Authorizationheader value, request body, response body, or any rawError/URLRequestobject.What
Sources/ComfySwiftSDK/Internal/SDKLog.swift(new): thinos.Loggerfacade under subsystemorg.comfy.ComfySwiftSDK, categoriestransport/websocket/polling. Includes an injectableSDKLogSinkoverride (SDKLog.overrideSink(_:)/resetSink()) for test capture without live OSLog.Transport.swift:translate(_:)logs the matched POSIX code on socket-drop paths and the error type name on the.unknownfallback.WebSocketSession.swift:runReadLooplogs theexecution_errorframe (job id only), the output-build catch after retry exhaustion (case name + job id), and the transient→polling-handoff vs.faileddecision.PollingFallback.swift: poll-loop logs non-transient give-up, output-assembly failure, and empty-output-exhaustion (all case name + job id).Tests/ComfySwiftSDKTests/LoggingPrivacyTests.swift(new): NFR-S2 enforcement suite. InstallsSDKLog.overrideSink, drives each failure path, and asserts that known credential sentinels (sk-SENTINEL-API-KEY-NFR-S2-TEST,bearer-SENTINEL-OAUTH-TOKEN-NFR-S2-TEST) never appear in any captured message. Includes a "poisoned error userInfo" test that embeds the sentinel in an underlying error'sNSLocalizedDescriptionKeyand verifies it does not leak.Why
On-device failures in the retry/recovery paths added by #3 (backgrounded job recovery, polling fallback, output-fetch transient retry) were completely silent in Console. When a user reports a blank result or a failed job, there is currently no SDK-level breadcrumb to distinguish "ECONNRESET on the first output download, retried and succeeded" from "ECONNRESET exhausted all retries". These logs close that gap.
Testing
swift build— clean (no errors, pre-existing warnings only)swift test— 132 tests, 0 failures, 4 skipped (live-network gates, unchanged)LoggingPrivacyTestssuite: 10 tests covering all logging call sites and the NFR-S2 sentinel assertionStacked on #3 — retargets to main when it merges.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.