fix: 10 audit fixes — memory safety, performance, accessibility, architecture

- Add a11y label to ProgressMapView reset button and progress bar values
- Fix CADisplayLink retain cycle in ItineraryTableViewController via deinit
- Add [weak self] to PhotoGalleryViewModel Task closure
- Add @MainActor to TripWizardViewModel, remove manual MainActor.run hop
- Fix O(n²) rank lookup in PollDetailView/DebugPollPreviewView with enumerated()
- Cache itinerarySections via ItinerarySectionBuilder static extraction + @State
- Convert CanonicalSyncService/BootstrapService from actor to @MainActor final class
- Add .accessibilityHidden(true) to RegionMapSelector Map to prevent duplicate VoiceOver

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-17 12:00:35 -06:00
parent 46434af4ab
commit 9b0cb96638
13 changed files with 415 additions and 109 deletions

View File

@@ -10,7 +10,8 @@ import Foundation
import SwiftData
import CloudKit
actor CanonicalSyncService {
@MainActor
final class CanonicalSyncService {
// MARK: - Errors
@@ -73,7 +74,6 @@ actor CanonicalSyncService {
/// - Parameters:
/// - context: The ModelContext to use for saving data
/// - cancellationToken: Optional token to check for cancellation between entity syncs
@MainActor
func syncAll(context: ModelContext, cancellationToken: SyncCancellationToken? = nil) async throws -> SyncResult {
let startTime = Date()
let syncState = SyncState.current(in: context)
@@ -391,7 +391,6 @@ actor CanonicalSyncService {
}
/// Re-enable sync after it was paused due to failures.
@MainActor
func resumeSync(context: ModelContext) {
let syncState = SyncState.current(in: context)
syncState.syncEnabled = true
@@ -418,7 +417,6 @@ actor CanonicalSyncService {
// MARK: - Individual Sync Methods
@MainActor
private func syncStadiums(
context: ModelContext,
since lastSync: Date?,
@@ -449,7 +447,6 @@ actor CanonicalSyncService {
return (updated, skippedIncompatible, skippedOlder)
}
@MainActor
private func syncTeams(
context: ModelContext,
since lastSync: Date?,
@@ -492,7 +489,6 @@ actor CanonicalSyncService {
return (updated, skippedIncompatible, skippedOlder)
}
@MainActor
private func syncGames(
context: ModelContext,
since lastSync: Date?,
@@ -546,7 +542,6 @@ actor CanonicalSyncService {
return (updated, skippedIncompatible, skippedOlder)
}
@MainActor
private func syncLeagueStructure(
context: ModelContext,
since lastSync: Date?,
@@ -571,7 +566,6 @@ actor CanonicalSyncService {
return (updated, skippedIncompatible, skippedOlder)
}
@MainActor
private func syncTeamAliases(
context: ModelContext,
since lastSync: Date?,
@@ -596,7 +590,6 @@ actor CanonicalSyncService {
return (updated, skippedIncompatible, skippedOlder)
}
@MainActor
private func syncStadiumAliases(
context: ModelContext,
since lastSync: Date?,
@@ -621,7 +614,6 @@ actor CanonicalSyncService {
return (updated, skippedIncompatible, skippedOlder)
}
@MainActor
private func syncSports(
context: ModelContext,
since lastSync: Date?,
@@ -654,7 +646,6 @@ actor CanonicalSyncService {
case skippedOlder
}
@MainActor
private func mergeStadium(
_ remote: Stadium,
canonicalId: String,
@@ -719,7 +710,6 @@ actor CanonicalSyncService {
}
}
@MainActor
private func mergeTeam(
_ remote: Team,
canonicalId: String,
@@ -810,7 +800,6 @@ actor CanonicalSyncService {
}
}
@MainActor
private func mergeGame(
_ remote: Game,
canonicalId: String,
@@ -925,7 +914,6 @@ actor CanonicalSyncService {
}
}
@MainActor
private func mergeLeagueStructure(
_ remote: LeagueStructureModel,
context: ModelContext
@@ -965,7 +953,6 @@ actor CanonicalSyncService {
}
}
@MainActor
private func mergeTeamAlias(
_ remote: TeamAlias,
context: ModelContext
@@ -1004,7 +991,6 @@ actor CanonicalSyncService {
}
}
@MainActor
private func mergeStadiumAlias(
_ remote: StadiumAlias,
context: ModelContext
@@ -1041,7 +1027,6 @@ actor CanonicalSyncService {
}
}
@MainActor
private func mergeSport(
_ remote: CanonicalSport,
context: ModelContext
@@ -1083,7 +1068,6 @@ actor CanonicalSyncService {
}
}
@MainActor
private func ensurePlaceholderStadium(
canonicalId: String,
sport: Sport,