Skip to content

ci: enforce strict type-checking and ban Any in sources - #41

Merged
victorhqc merged 1 commit into
mainfrom
feat/harden-type-safety
Jul 25, 2026
Merged

ci: enforce strict type-checking and ban Any in sources#41
victorhqc merged 1 commit into
mainfrom
feat/harden-type-safety

Conversation

@victorhqc

Copy link
Copy Markdown
Owner

Summary

Turn on strict type-checking and ban the Any type in Sources/. Every source target now builds with warnings-as-errors and complete concurrency checking. A new AnyJSON enum replaces [String: Any] at the JSON serialization boundary while keeping Codable round-trips.

Why

The codebase relied on Any at 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

  • Swift compiler flags-warnings-as-errors and -strict-concurrency=complete added to every source target in Package.swift; test targets are exempt
  • SwiftLint strict rulesforce_unwrapping, force_cast, force_try, and implicitly_unwrapped_optional set to error, plus a custom no_any_type rule that bans Any in Sources/ (with Tests/.swiftlint.yml exempting test targets)
  • AnyJSON type — new Codable + Sendable + Equatable enum in Sources/Core/AnyJSON.swift that round-trips arbitrary JSON without exposing Any
  • AnyAnyJSON migration — all [String: Any] and JSONSerialization usages in Sources/ and Sources/Providers/ClaudeCode/ replaced with Codable models or AnyJSON; the Security-framework boundary in KeychainStorage.swift is the sole documented exception, annotated with per-line swiftlint:disable
  • Spec addedspecs/ci/04-strict-type-checking.md documents the acceptance criteria, plan, and risks

Notes for review

  • The three swiftlint:disable:next no_any_type annotations in KeychainStorage.swift are required because SecItem* APIs demand [String: Any] dictionaries. This is the only exception (ci 04 AC6).
  • Tests/.swiftlint.yml disables all four strict rules plus no_any_type so test code doesn't gate on non-production patterns (ci 04 AC1/AC5).

@victorhqc
victorhqc merged commit 6aedf67 into main Jul 25, 2026
1 check passed
@victorhqc
victorhqc deleted the feat/harden-type-safety branch July 25, 2026 22:36
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.

1 participant