Skip to content

v3.3.0: CDUntappdKitTesting Product + HTTP Error Headers - #42

Merged
chrisdhaan merged 4 commits into
masterfrom
feature/39-40-testing-product-and-http-error-headers
Aug 19, 2026
Merged

chrisdhaan merged 4 commits into
masterfrom
feature/39-40-testing-product-and-http-error-headers

Conversation

@chrisdhaan

Copy link
Copy Markdown
Owner

Summary

  • Adds a public CDUntappdKitTesting SPM product exposing CDUntappdMockURLProtocol (moved from Tests/ to Source/Testing/), so downstream consumers can mock CDUntappdKit-backed network calls in their own test suites without reimplementing a URLProtocol stub. CDUntappdAPIClient's urlSession:-accepting initializer is now public to pair with it. Closes Promote request mocking to a public CDUntappdKitTesting product #39.
  • Adds CDUntappdKitError.httpErrorWithHeaders(statusCode:data:headers:), carrying the failed response's HTTP headers (e.g. Retry-After, rate-limit headers) alongside the status code and body. The prior httpError(statusCode:data:) case is deprecated and no longer thrown by the library — kept only for source compatibility with existing exhaustive pattern matches. Closes CDUntappdKitError.httpError discards response headers #40.
  • Both changes are additive (new product, new error case); nothing is removed, so this ships as v3.3.0 rather than v3.2.2 or a major bump.

Test plan

  • swift test — 279 tests pass, including a new CDUntappdKitTestingProductTests.swift that exercises the full public product end-to-end (no @testable) exactly as a downstream consumer would
  • swiftformat Source Tests --lint — clean
  • xcodebuild -project CDUntappdKit.xcodeproj -scheme "CDUntappdKit iOS" build — confirms Source/Testing stays excluded from the main framework target and SwiftLint passes
  • swift package generate-documentation --target CDUntappdKit — DocC build clean, no warnings

Claude-Session: https://claude.ai/code/session_01HdhEtXezNpB31vv93S5D4b

Adds a public CDUntappdKitTesting SPM product exposing
CDUntappdMockURLProtocol, so downstream consumers can mock
CDUntappdKit-backed network calls in their own test suites
(closes #39). CDUntappdAPIClient's urlSession:-accepting
initializer is now public to pair with it.

Adds CDUntappdKitError.httpErrorWithHeaders(statusCode:data:headers:),
carrying the failed response's HTTP headers (e.g. Retry-After,
rate-limit headers) alongside the status code and body. The prior
httpError(statusCode:data:) case is deprecated and no longer thrown
(closes #40).

Claude-Session: https://claude.ai/code/session_01HdhEtXezNpB31vv93S5D4b

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
chrisdhaan and others added 3 commits August 18, 2026 22:07
CDUntappdMockURLProtocol.canInit/canonicalRequest override
URLProtocol's `class func` as `override class func`, but SwiftLint's
CI-only `Source`-scoped lint pass never caught this while the file
lived under Tests/. Now that it's public API under Source/Testing/,
switch to `override static func`, valid since the class is final.

Claude-Session: https://claude.ai/code/session_01HdhEtXezNpB31vv93S5D4b

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
CDUntappdEventMonitor.requestDidComplete(...) and CDUntappdURLSession's
notifyComplete(...) wrote error: Error? instead of error: (any Error)?,
pre-existing warnings under the ExistentialAny upcoming feature this
package enables, unrelated to this PR's changes but flagged in the same
CI run.

CDUntappdMockURLProtocol.Stub.error was (any Error)?, non-Sendable,
which warned on the DispatchQueue.asyncAfter closure that captures a
Stub. Constrained it to (any Error & Sendable)? (matching
CDUntappdKitError's own any Error & Sendable convention) and made Stub
itself Sendable — this surfaced now that the file lives in Source/
rather than Tests/.

Claude-Session: https://claude.ai/code/session_01HdhEtXezNpB31vv93S5D4b

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Package.swift's platform minimums (iOS 15 / macOS 12 / tvOS 15 /
watchOS 8 / visionOS 1) already exceed every one of these gates:
the async/await @available(macOS 10.15, iOS 13.0, ...) marker on
every async method, the Logger @available(iOS 14.0, macOS 11.0, ...)
gate at file scope, and the matching `if #available(iOS 14.0, ...)`
runtime checks wrapping every logger.error(...) call. All of them
were always-true given the current floor, so they're deleted rather
than satisfied by a higher SDK - no SDK bump changes anything here.

Also drops the iOS 13 UIWindowScene availability check and its dead
pre-scene `keyWindow` fallback in UIApplication.topViewController(_:),
for the same reason.

Claude-Session: https://claude.ai/code/session_01HdhEtXezNpB31vv93S5D4b

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@chrisdhaan
chrisdhaan merged commit dfe229d into master Aug 19, 2026
37 checks passed
@chrisdhaan
chrisdhaan deleted the feature/39-40-testing-product-and-http-error-headers branch August 19, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CDUntappdKitError.httpError discards response headers Promote request mocking to a public CDUntappdKitTesting product

1 participant