Skip to content

Remove redundant @unchecked Sendable annotations#201

Merged
swhitty merged 1 commit into
swhitty:mainfrom
ianegordon:ian/unchecked-sendable-group-a
Apr 23, 2026
Merged

Remove redundant @unchecked Sendable annotations#201
swhitty merged 1 commit into
swhitty:mainfrom
ianegordon:ian/unchecked-sendable-group-a

Conversation

@ianegordon

Copy link
Copy Markdown
Contributor

Summary

Removes @unchecked Sendable annotations from four sites where the declaration is either redundant (the containing type is already Sendable by other means) or correct with a plain Sendable conformance (all contained values are Sendable).

File:Line Before After
HTTPResponse.swift:40 public enum Payload: @unchecked Sendable public enum Payload: Sendable
WSMessage.swift:34 public enum WSMessage: @unchecked Sendable, Hashable public enum WSMessage: Sendable, Hashable
HTTPConnection.swift:113 actor HTTPRequestSequence<...>: AsyncSequence, AsyncIteratorProtocol, @unchecked Sendable actor HTTPRequestSequence<...>: AsyncSequence, AsyncIteratorProtocol
Logging+OSLog.swift:36 public struct OSLogLogger: Logging, @unchecked Sendable public struct OSLogLogger: Logging

Rationale (primary-source verified)

  • HTTPResponse.Payload: .httpBody(HTTPBodySequence)HTTPBodySequence: Sendable (HTTPBodySequence.swift:35). .webSocket(any WSHandler)WSHandler: Sendable (WSHandler.swift:34).
  • WSMessage: associated values are String, Data, WSCloseCode. WSCloseCode: Sendable (WSCloseCode.swift:34); String / Data are Sendable.
  • HTTPRequestSequence: per SE-0306, "every actor type implicitly conforms to the Sendable protocol." Explicit @unchecked Sendable (or even explicit Sendable) on an actor is redundant.
  • OSLogLogger: os.Logger is declared public struct Logger : @unchecked Swift.Sendable in the Xcode SDK os.swiftmodule interface, and the Logging protocol already requires Sendable (Logging.swift:32) — so both the @unchecked and the explicit Sendable conformance were redundant.

Test plan

  • swift build clean (no warnings, 5.16 s).
  • swift test — 404 tests across 49 suites, all pass (1.13 s total).
  • CI on the upstream repo.

Scope

This is Group A of a broader @unchecked Sendable audit. The remaining 12 sites fall into two categories:

  • Group B — replace with synchronized state (e.g., Mutex-wrapped storage): HTTPBodySequence.Storage, AsyncStream+WSFrame.Iterator, WSFrameValidator.Validator. To be submitted separately.
  • Group C — keep @unchecked with a justifying comment (Transferring, Mutex variants, ConsumingAsyncSequence.SharedBuffer/State, retroactive sockaddr_* conformances). To be submitted separately.

🤖 Generated with Claude Code

All four sites contained only Sendable types:
- HTTPResponse.Payload: both cases hold Sendable values
  (HTTPBodySequence, any WSHandler).
- WSMessage: associated values are Sendable.
- HTTPRequestSequence: actors implicitly conform to Sendable
  per SE-0306.
- OSLogLogger: os.Logger is @unchecked Sendable and the Logging
  protocol already requires Sendable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ianegordon ianegordon marked this pull request as ready for review April 23, 2026 02:14
@swhitty swhitty merged commit 8f903a8 into swhitty:main Apr 23, 2026
21 of 22 checks passed
@codecov

codecov Bot commented Apr 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.40%. Comparing base (d97e0e2) to head (5433469).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #201   +/-   ##
=======================================
  Coverage   92.40%   92.40%           
=======================================
  Files          69       69           
  Lines        3543     3543           
=======================================
  Hits         3274     3274           
  Misses        269      269           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ianegordon ianegordon deleted the ian/unchecked-sendable-group-a branch April 24, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants