feat: enable strict concurrency checking#28
Merged
Conversation
- Add Sendable to HTTP.ResponseStatus (enum with Int raw value) - Add Sendable to KumoLogger protocol - Add @unchecked Sendable to HTTPError (contains Any types) - Add @unchecked Sendable to CacheSerializationError/CacheDeserializationError - Add @unchecked Sendable to StorageAccessError - Add @unchecked Sendable to InMemory (GCD queue-based thread safety) - Restore -strict-concurrency=complete in CI workflow Build passes with zero concurrency warnings.
- Add @unchecked Sendable to StorageAccessError (contains Any) - Fix InMemory GCD closures: use nonisolated(unsafe) for weak self and type-erase generic D to Any before closure to avoid D.Type metatype capture warning - Result: zero concurrency warnings with -strict-concurrency=complete
…remaining - Fix weak var -> weak let in InMemory GCD closures (3 warnings) - Add doc comment to UncheckedSendableBox explaining why it exists - All 9 @unchecked Sendable usages audited and verified as required - Zero concurrency warnings with -strict-concurrency=complete
5a7c315 to
3c44489
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables
-strict-concurrency=completein CI with zero concurrency warnings.Changes (6 files, minimal):
HTTP.ResponseStatus— addedSendable(enum with Int raw value, trivially Sendable)KumoLogger— addedSendableto protocolHTTPError— added@unchecked Sendable(containsAnytypes that can't be made Sendable without breaking API)CacheSerializationError/CacheDeserializationError— added@unchecked SendableStorageAccessError— added@unchecked SendableInMemory— added@unchecked Sendable(already thread-safe via GCD queue)swift.yml— restored-strict-concurrency=completeflagWhy
@unchecked Sendable:Several error types use
Anyin their associated values. ChangingAnytoany Sendablecascades through the entire codebase (every callsite passes[String: Any]dictionaries). Using@unchecked Sendableis the pragmatic approach — these error types are created and thrown, not shared across concurrency domains.Result:
swift build -Xswiftc -strict-concurrency=completepasses with zero concurrency warnings.