[PR #1] [MERGED] feat: X-Comfy-Client traceability header (+ fix source-level test after extraction) #6

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

📋 Pull Request Information

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

Base: main ← Head: feat/client-traceability-header


📝 Commits (2)

  • 69ff980 feat: stamp X-Comfy-Client header on every request for log traceability
  • 6dd1933 fix(test): point source-level reattach test at the standalone package root

📊 Changes

4 files changed (+73 additions, -8 deletions)

View changed files

➕ Sources/ComfySwiftSDK/Internal/ComfySDKInfo.swift (+38 -0)
📝 Sources/ComfySwiftSDK/Public/ComfyCloudClient.swift (+2 -2)
➕ Tests/ComfySwiftSDKTests/ComfySDKInfoTests.swift (+26 -0)
📝 Tests/ComfySwiftSDKTests/ReattachCoordinatorTests.swift (+7 -6)

📄 Description

Adds lightweight request traceability to the SDK so Comfy Cloud can attribute SDK / Comfy Go traffic in logs — and repairs a test that broke when the package was extracted to its own repo.

Traceability header

  • Every SDK request now carries X-Comfy-Client: comfyswiftsdk/<version>, set via the session's httpAdditionalHeaders in a new ComfySDKInfo.sessionConfiguration().
  • Both URLSession construction sites route through it, so the header rides every path: REST, the WebSocket upgrade handshake, and the OAuth token exchange.
  • New ComfySDKInfo holds the version (the SDK had no version constant) + header name/value.
  • Deliberately minimal: one client header for traceability, no device/user/usage data. Auth identity already rides the bearer token's client_id claim. Per-request Authorization / Content-Type headers are untouched and take precedence.
  • Guard tests added (ComfySDKInfoTests).

Drive-by test fix

  • ReattachCoordinatorTests reads ComfyCloudClient.swift off disk for a source-level assertion, walking five dirs up from #filePath to the old Comfy-iOS/Packages/ComfySwiftSDK/… nested layout. After extraction the package root is three up — it was failing on every fresh clone (NSFileReadNoSuchFile). Fixed the path math.

Verification

  • swift build — clean.
  • swift test — 96/96 pass (was 94, 1 failing pre-PR due to the path bug; +2 new header tests).

Notes: there's a stale --package-path Packages/ComfySwiftSDK reference in an OAuthMetadataIntegrationTests doc comment (non-functional) — left for a later sweep.


🔄 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/1 **Author:** [@mattmillerai](https://github.com/mattmillerai) **Created:** 6/18/2026 **Status:** ✅ Merged **Merged:** 6/18/2026 **Merged by:** [@mattmillerai](https://github.com/mattmillerai) **Base:** `main` ← **Head:** `feat/client-traceability-header` --- ### 📝 Commits (2) - [`69ff980`](https://github.com/Comfy-Org/comfy-swift-sdk/commit/69ff9809c43f04a97fdef053f92a6a9ce7a22a08) feat: stamp X-Comfy-Client header on every request for log traceability - [`6dd1933`](https://github.com/Comfy-Org/comfy-swift-sdk/commit/6dd19331f0a81db8becb43ff84a4d77ac9c1029f) fix(test): point source-level reattach test at the standalone package root ### 📊 Changes **4 files changed** (+73 additions, -8 deletions) <details> <summary>View changed files</summary> ➕ `Sources/ComfySwiftSDK/Internal/ComfySDKInfo.swift` (+38 -0) 📝 `Sources/ComfySwiftSDK/Public/ComfyCloudClient.swift` (+2 -2) ➕ `Tests/ComfySwiftSDKTests/ComfySDKInfoTests.swift` (+26 -0) 📝 `Tests/ComfySwiftSDKTests/ReattachCoordinatorTests.swift` (+7 -6) </details> ### 📄 Description Adds lightweight request traceability to the SDK so Comfy Cloud can attribute SDK / Comfy Go traffic in logs — and repairs a test that broke when the package was extracted to its own repo. ## Traceability header - Every SDK request now carries **`X-Comfy-Client: comfyswiftsdk/<version>`**, set via the session's `httpAdditionalHeaders` in a new `ComfySDKInfo.sessionConfiguration()`. - Both `URLSession` construction sites route through it, so the header rides **every** path: REST, the **WebSocket upgrade handshake**, and the **OAuth token exchange**. - New `ComfySDKInfo` holds the version (the SDK had no version constant) + header name/value. - Deliberately minimal: one client header for traceability, **no device/user/usage data**. Auth identity already rides the bearer token's `client_id` claim. Per-request `Authorization` / `Content-Type` headers are untouched and take precedence. - Guard tests added (`ComfySDKInfoTests`). ## Drive-by test fix - `ReattachCoordinatorTests` reads `ComfyCloudClient.swift` off disk for a source-level assertion, walking **five** dirs up from `#filePath` to the old `Comfy-iOS/Packages/ComfySwiftSDK/…` nested layout. After extraction the package root is **three** up — it was failing on every fresh clone (`NSFileReadNoSuchFile`). Fixed the path math. ## Verification - `swift build` — clean. - `swift test` — **96/96 pass** (was 94, 1 failing pre-PR due to the path bug; +2 new header tests). Notes: there's a stale `--package-path Packages/ComfySwiftSDK` reference in an `OAuthMetadataIntegrationTests` doc comment (non-functional) — left for a later sweep. --- <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:50 +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#6
No description provided.