krz/hutch

an ios client for sourcehut

clone: git clone https://gitbay.org/krz/hutch.git

c0744a35891f89e50ab407a0b8557ce9d5c5e6cc

verified · cmc

author: Christian Cleberg <hello@cleberg.net> · 2026-04-12T15:11:21Z

chore: clean up debug logging
 Hutch.xcodeproj/project.pbxproj                        | 16 ++++++++--------
 Hutch/Networking/HutchStatsService.swift               | 12 ------------
 Hutch/Views/Builds/BuildDetailViewModel.swift          |  4 ----
 Hutch/Views/Lookup/ContributionCalendarViewModel.swift | 12 ------------
 Hutch/Views/Lookup/LookupView.swift                    |  4 ----
 Hutch/Views/Lookup/UserProfileViewModel.swift          | 16 ----------------
 6 files changed, 8 insertions(+), 56 deletions(-)

diff --git a/Hutch.xcodeproj/project.pbxproj b/Hutch.xcodeproj/project.pbxproj
index 1020bb0..1fe01ce 100644
--- a/Hutch.xcodeproj/project.pbxproj
+++ b/Hutch.xcodeproj/project.pbxproj
@@ -515,7 +515,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 32;
+				CURRENT_PROJECT_VERSION = 33;
 				DEVELOPMENT_TEAM = ZCNAX3VL9D;
 				ENABLE_PREVIEWS = YES;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -532,7 +532,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 2.15.0;
+				MARKETING_VERSION = 2.15.1;
 				PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -552,7 +552,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 32;
+				CURRENT_PROJECT_VERSION = 33;
 				DEVELOPMENT_TEAM = ZCNAX3VL9D;
 				ENABLE_PREVIEWS = YES;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -569,7 +569,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 2.15.0;
+				MARKETING_VERSION = 2.15.1;
 				PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -632,7 +632,7 @@
 				APPLICATION_EXTENSION_API_ONLY = YES;
 				CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 32;
+				CURRENT_PROJECT_VERSION = 33;
 				DEVELOPMENT_TEAM = ZCNAX3VL9D;
 				GENERATE_INFOPLIST_FILE = NO;
 				INFOPLIST_FILE = HutchWidgetExtension/Info.plist;
@@ -642,7 +642,7 @@
 					"@executable_path/Frameworks",
 					"@executable_path/../../Frameworks",
 				);
-				MARKETING_VERSION = 2.15.0;
+				MARKETING_VERSION = 2.15.1;
 				PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
@@ -661,7 +661,7 @@
 				APPLICATION_EXTENSION_API_ONLY = YES;
 				CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 32;
+				CURRENT_PROJECT_VERSION = 33;
 				DEVELOPMENT_TEAM = ZCNAX3VL9D;
 				GENERATE_INFOPLIST_FILE = NO;
 				INFOPLIST_FILE = HutchWidgetExtension/Info.plist;
@@ -671,7 +671,7 @@
 					"@executable_path/Frameworks",
 					"@executable_path/../../Frameworks",
 				);
-				MARKETING_VERSION = 2.15.0;
+				MARKETING_VERSION = 2.15.1;
 				PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
diff --git a/Hutch/Networking/HutchStatsService.swift b/Hutch/Networking/HutchStatsService.swift
index cb08715..69a2a20 100644
--- a/Hutch/Networking/HutchStatsService.swift
+++ b/Hutch/Networking/HutchStatsService.swift
@@ -20,7 +20,6 @@ struct HutchStatsService: ContributionCalendarServing {
     }
 
     func fetchContributionCalendar(actor: String, endingOn endDate: Date) async throws -> ContributionCalendarResponse {
-        debugLog("calendar request actor=\(actor) endDate=\(Self.rangeFormatter.string(from: endDate))")
         return try await fetch(
             path: "api/contributions/\(actor)",
             queryItems: trailingYearQueryItems(endingOn: endDate),
@@ -29,7 +28,6 @@ struct HutchStatsService: ContributionCalendarServing {
     }
 
     func fetchContributionStats(actor: String, endingOn endDate: Date) async throws -> ContributionStatsResponse {
-        debugLog("stats request actor=\(actor) endDate=\(Self.rangeFormatter.string(from: endDate))")
         return try await fetch(
             path: "api/contributions/\(actor)/stats",
             queryItems: trailingYearQueryItems(endingOn: endDate),
@@ -53,17 +51,14 @@ struct HutchStatsService: ContributionCalendarServing {
             throw URLError(.badURL)
         }
 
-        debugLog("request \(url.absoluteString)")
         let (data, response): (Data, URLResponse)
         do {
             (data, response) = try await session.data(from: url)
         } catch {
-            debugLog("network failure \(url.absoluteString) error=\(error.localizedDescription)")
             throw SRHTError.networkError(error)
         }
 
         if let httpResponse = response as? HTTPURLResponse {
-            debugLog("response \(url.absoluteString) status=\(httpResponse.statusCode) bytes=\(data.count)")
             if !(200...299).contains(httpResponse.statusCode) {
                 throw SRHTError.httpError(httpResponse.statusCode)
             }
@@ -72,8 +67,6 @@ struct HutchStatsService: ContributionCalendarServing {
         do {
             return try decoder.decode(responseType, from: data)
         } catch {
-            let preview = String(decoding: data.prefix(300), as: UTF8.self)
-            debugLog("decode failure \(url.absoluteString) error=\(error.localizedDescription) body=\(preview)")
             throw SRHTError.decodingError(error)
         }
     }
@@ -113,9 +106,4 @@ struct HutchStatsService: ContributionCalendarServing {
         return formatter
     }()
 
-    private func debugLog(_ message: String) {
-#if DEBUG
-        print("[HutchStatsService] \(message)")
-#endif
-    }
 }
diff --git a/Hutch/Views/Builds/BuildDetailViewModel.swift b/Hutch/Views/Builds/BuildDetailViewModel.swift
index ec4d265..88b9e42 100644
--- a/Hutch/Views/Builds/BuildDetailViewModel.swift
+++ b/Hutch/Views/Builds/BuildDetailViewModel.swift
@@ -315,8 +315,6 @@ final class BuildDetailViewModel {
         guard autoRefreshTask == nil else { return }
         guard shouldAutoRefresh else { return }
 
-        print("Build auto-refresh started")
-
         autoRefreshTask = Task { [weak self] in
             while !Task.isCancelled {
                 do {
@@ -336,7 +334,6 @@ final class BuildDetailViewModel {
 
         autoRefreshTask.cancel()
         self.autoRefreshTask = nil
-        print("Build auto-refresh stopped")
     }
 
     private var shouldAutoRefresh: Bool {
@@ -352,7 +349,6 @@ final class BuildDetailViewModel {
             return
         }
 
-        print("Build refresh tick")
         await loadJob()
         await loadBuildLog()
     }
diff --git a/Hutch/Views/Lookup/ContributionCalendarViewModel.swift b/Hutch/Views/Lookup/ContributionCalendarViewModel.swift
index 1ff789d..acbae2d 100644
--- a/Hutch/Views/Lookup/ContributionCalendarViewModel.swift
+++ b/Hutch/Views/Lookup/ContributionCalendarViewModel.swift
@@ -116,8 +116,6 @@ final class ContributionCalendarViewModel {
         isLoading = true
         loadErrorMessage = nil
         defer { isLoading = false }
-        debugLog("load start actor=\(actor) endDate=\(selectedEndDate.formatted(date: .abbreviated, time: .omitted))")
-
         let fetchedCalendar: ContributionCalendarResponse?
         let fetchedStats: ContributionStatsResponse?
         var errors: [any Error] = []
@@ -147,11 +145,6 @@ final class ContributionCalendarViewModel {
             loadErrorMessage = errors.first?.userFacingMessage
         }
 
-        debugLog(
-            "load complete actor=\(actor) endDate=\(selectedEndDate.formatted(date: .abbreviated, time: .omitted)) state=\(String(describing: displayState)) " +
-            "calendarDays=\(calendar?.days.count ?? 0) totalEvents=\(stats?.totalEvents ?? 0) " +
-            "indexingState=\(String(describing: effectiveIndexingState)) error=\(loadErrorMessage ?? "none")"
-        )
     }
 
     func selectPreviousYear() async {
@@ -196,9 +189,4 @@ final class ContributionCalendarViewModel {
         return normalizedStartDate...normalizedEndDate
     }
 
-    private func debugLog(_ message: String) {
-#if DEBUG
-        print("[ContributionCalendarViewModel] \(message)")
-#endif
-    }
 }
diff --git a/Hutch/Views/Lookup/LookupView.swift b/Hutch/Views/Lookup/LookupView.swift
index e571140..e0adc6b 100644
--- a/Hutch/Views/Lookup/LookupView.swift
+++ b/Hutch/Views/Lookup/LookupView.swift
@@ -201,8 +201,6 @@ final class LookupViewModel {
         }
         """
 
-        lookupLogger.debug("Looking up user profile for username: \(username, privacy: .public)")
-
         let result: Response
         do {
             result = try await client.execute(
@@ -225,8 +223,6 @@ final class LookupViewModel {
             throw error
         }
 
-        lookupLogger.debug("User lookup succeeded for username: \(username, privacy: .public)")
-
         return .user(result.user)
     }
 
diff --git a/Hutch/Views/Lookup/UserProfileViewModel.swift b/Hutch/Views/Lookup/UserProfileViewModel.swift
index 143cb6f..56c2852 100644
--- a/Hutch/Views/Lookup/UserProfileViewModel.swift
+++ b/Hutch/Views/Lookup/UserProfileViewModel.swift
@@ -85,8 +85,6 @@ final class UserProfileViewModel {
         defer { isLoadingContributions = false }
 
         let resolvedEndDate = Calendar.contributionCalendar.startOfDay(for: endDate ?? Date())
-        debugLog("profile contributions start actor=\(actor) endDate=\(resolvedEndDate.formatted(date: .abbreviated, time: .omitted))")
-
         do {
             async let contributionCalendar = statsService.fetchContributionCalendar(actor: actor, endingOn: resolvedEndDate)
             async let contributionStats = statsService.fetchContributionStats(actor: actor, endingOn: resolvedEndDate)
@@ -96,17 +94,8 @@ final class UserProfileViewModel {
             if contributionDisplayState != .unavailable {
                 contributionsError = nil
             }
-            debugLog(
-                "profile contributions complete actor=\(actor) endDate=\(resolvedEndDate.formatted(date: .abbreviated, time: .omitted)) " +
-                "state=\(String(describing: contributionDisplayState)) days=\(self.contributionCalendar?.days.count ?? 0) " +
-                "totalEvents=\(self.contributionStats?.totalEvents ?? 0) error=\(contributionsError ?? "none")"
-            )
         } catch {
             contributionsError = error.userFacingMessage
-            debugLog(
-                "profile contributions failed actor=\(actor) endDate=\(resolvedEndDate.formatted(date: .abbreviated, time: .omitted)) " +
-                "error=\(error.localizedDescription) userFacing=\(contributionsError ?? "none")"
-            )
         }
     }
 
@@ -232,9 +221,4 @@ final class UserProfileViewModel {
         }
     }
 
-    private func debugLog(_ message: String) {
-#if DEBUG
-        print("[UserProfileViewModel] \(message)")
-#endif
-    }
 }