ci: enforce strict type-checking and ban Any in sources - #41
Merged
Conversation
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.
Summary
Turn on strict type-checking and ban the
Anytype inSources/. Every source target now builds with warnings-as-errors and complete concurrency checking. A newAnyJSONenum replaces[String: Any]at the JSON serialization boundary while keepingCodableround-trips.Why
The codebase relied on
Anyat several JSON and Security-framework edges, making it easy to introduce runtime type mismatches. Without strict concurrency checking, potential data races from shared mutable state go undetected until they crash the menu bar. This branch closes both gaps (ci 04).What changed
-warnings-as-errorsand-strict-concurrency=completeadded to every source target inPackage.swift; test targets are exemptforce_unwrapping,force_cast,force_try, andimplicitly_unwrapped_optionalset toerror, plus a customno_any_typerule that bansAnyinSources/(withTests/.swiftlint.ymlexempting test targets)AnyJSONtype — newCodable + Sendable + Equatableenum inSources/Core/AnyJSON.swiftthat round-trips arbitrary JSON without exposingAnyAny→AnyJSONmigration — all[String: Any]andJSONSerializationusages inSources/andSources/Providers/ClaudeCode/replaced withCodablemodels orAnyJSON; the Security-framework boundary inKeychainStorage.swiftis the sole documented exception, annotated with per-lineswiftlint:disablespecs/ci/04-strict-type-checking.mddocuments the acceptance criteria, plan, and risksNotes for review
swiftlint:disable:next no_any_typeannotations inKeychainStorage.swiftare required becauseSecItem*APIs demand[String: Any]dictionaries. This is the only exception (ci 04 AC6).Tests/.swiftlint.ymldisables all four strict rules plusno_any_typeso test code doesn't gate on non-production patterns (ci 04 AC1/AC5).