Hi, we ran into Swift concurrency warnings when using IMAPClientHandler with SwiftNIO async pipeline APIs from tests in SwiftMail.
The pattern is:
try await channel.pipeline.addHandler(IMAPClientHandler())
ChannelPipeline.addHandler requires ChannelHandler & Sendable, but IMAPClientHandler is not currently declared Sendable, so the compiler warns that IMAPClientHandler does not conform to Sendable. For now we are using a test-target workaround:
@preconcurrency import NIOIMAP
extension IMAPClientHandler: @retroactive @unchecked Sendable {}
That works for our event-loop-confined usage, but it would be nicer not to need a downstream retroactive conformance. How would the maintainers prefer this to be addressed?
Options that came to mind:
- mark
IMAPClientHandler as @unchecked Sendable upstream, matching NIO event-loop confinement expectations
- provide a recommended wrapper or factory for async pipeline installation
- use another model if the handler should not be treated as Sendable, possibly actor-based or otherwise isolated
Happy to open a PR if there is an intended direction.
Hi, we ran into Swift concurrency warnings when using
IMAPClientHandlerwith SwiftNIO async pipeline APIs from tests in SwiftMail.The pattern is:
ChannelPipeline.addHandlerrequiresChannelHandler & Sendable, butIMAPClientHandleris not currently declaredSendable, so the compiler warns thatIMAPClientHandlerdoes not conform toSendable. For now we are using a test-target workaround:That works for our event-loop-confined usage, but it would be nicer not to need a downstream retroactive conformance. How would the maintainers prefer this to be addressed?
Options that came to mind:
IMAPClientHandleras@unchecked Sendableupstream, matching NIO event-loop confinement expectationsHappy to open a PR if there is an intended direction.