Skip to content

Enforce warning-free Swift builds#912

Closed
robinebers wants to merge 1 commit into
mainfrom
codex/enforce-warning-free-swift
Closed

Enforce warning-free Swift builds#912
robinebers wants to merge 1 commit into
mainfrom
codex/enforce-warning-free-swift

Conversation

@robinebers

@robinebers robinebers commented Jul 9, 2026

Copy link
Copy Markdown
Owner

TL;DR

The app and test targets now treat every Swift warning as an error. All existing warnings are resolved, including actor-isolated reset presentation logic that has been moved out of the SwiftUI view into a pure model.

What was happening

  • SwiftPM builds completed with recurring compiler warnings in provider defaults, cache bookkeeping, a shared formatter, and concurrency-sensitive tests.
  • Reset formatting lived inside a SwiftUI View, which implicitly isolated otherwise pure helpers to the main actor.
  • Nothing prevented a new warning from accumulating unnoticed.

What this changes

  • Enables .treatAllWarnings(as: .error) for both the OpenUsage executable and test target.
  • Documents the warning-free build and CI policy in AGENTS.md.
  • Removes redundant pricing-closure awaits and the obsolete unsafe formatter annotation.
  • Explicitly discards the cache set-insertion result.
  • Makes the login-shell concurrency test synchronize its captured result.
  • Extracts RateLimitResetsPresentation as a Foundation-only, independently tested model and keeps the view render-only.

Heads-up

  • This intentionally makes future warnings CI-blocking. Dependency targets are not changed by the package target settings.
  • The reset-presentation extraction has no intended visual or copy change.

Tests

  • Focused warning and reset tests — 24 passed
  • swift test — 962 XCTest tests passed, 3 skipped; 3 Swift Testing tests passed
  • swift build — passed with warnings treated as errors
  • ./script/build_and_run.sh verify — warning-free release build, signing, launch, and process verification passed
  • git diff --check

Note

Low Risk
Mostly build policy and warning fixes plus a refactor with existing tests; behavior should be unchanged aside from stricter future builds.

Overview
Swift warnings are now CI-blocking for both the OpenUsage app and test targets via .treatAllWarnings(as: .error) in Package.swift, with AGENTS.md updated to match.

Compiler hygiene: default provider pricing closures drop redundant await on synchronous ModelPricingStore.current(); CopilotUsageMapper drops nonisolated(unsafe) on its static DateFormatter; ProviderSnapshotCache explicitly discards the set-insert result; and the login-shell off-main-thread test uses OSAllocatedUnfairLock instead of capturing a mutable var across concurrency boundaries.

Rate-limit resets popover: timeline formatting and the empty / count-only / timeline state machine move from RateLimitResetsDetail into RateLimitResetsPresentation (Foundation-only, independently unit-tested); the SwiftUI view only renders. No intended UI or copy change.

Reviewed by Cursor Bugbot for commit 85ee7ef. Bugbot is set up for automated code reviews on this repo. Configure here.

@robinebers robinebers added the gate-passed Passed the automated PR gatekeeper checks (gatekeeper skips it on later runs) label Jul 9, 2026 — with Cursor
@robinebers

Copy link
Copy Markdown
Owner Author

Superseded by #949, which combines the warning gate with deterministic build/run verification in two review-separated commits. #949 preserves this PR’s warning cleanup and pure presentation extraction, has a 202-line total diff, and is fully green. This branch remains preserved; nothing was merged.

@robinebers robinebers closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gate-passed Passed the automated PR gatekeeper checks (gatekeeper skips it on later runs) provider tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant