From d7ac22175b3badbb010a5cf098c0d97b76da4d85 Mon Sep 17 00:00:00 2001 From: Abdulaziz Albahar <67667005+azooz2003-bit@users.noreply.github.com> Date: Mon, 17 Aug 2026 11:48:38 -0700 Subject: [PATCH] fix(ios): restore exhaustive artifact switches for TestFlight archive The TestFlight INTERNAL upload on main fails to archive because 04ff18eea6 added ChatArtifactError.unknown(code:) and ChatArtifactLoaderScope.panel without updating two exhaustive switches: - ChatArtifactFailurePresentation now presents .unknown(code:) with localized retryable copy that names the unrecognized Mac error code instead of blaming connectivity (en + ja). - ChatArtifactInlineViewer maps loader scope .panel to viewer scope .panel so panel-scoped forbidden copy is accurate. - ChatArtifactViewerModel.state(for:stat:) becomes internal; the ChatArtifactViewerErrorStateTests added by that commit call it and never compiled. Failing run: https://github.com/manaflow-ai/cmux/actions/runs/32053999924 Co-Authored-By: Claude Fable 5 --- .../ChatArtifactFailurePresentation.swift | 21 +++++++++++++++++++ .../Artifacts/ChatArtifactInlineViewer.swift | 2 ++ .../Artifacts/ChatArtifactViewerModel.swift | 2 +- .../Resources/Localizable.xcstrings | 21 +++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactFailurePresentation.swift b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactFailurePresentation.swift index c9dd54d5f23c..a52c45f0b6ae 100644 --- a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactFailurePresentation.swift +++ b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactFailurePresentation.swift @@ -258,6 +258,13 @@ public struct ChatArtifactFailurePresentation: Equatable, Sendable { systemImage: "doc.badge.ellipsis", allowsRetry: false ) + case .unknown(let code): + self = Self( + title: Self.localized("chat.artifact.failure.unknown.title", defaultValue: "Unexpected error"), + message: Self.unknownMessage(code: code), + systemImage: "questionmark.circle", + allowsRetry: true + ) } } @@ -291,6 +298,20 @@ public struct ChatArtifactFailurePresentation: Equatable, Sendable { String(localized: key, defaultValue: defaultValue, bundle: .module) } + private static func unknownMessage(code: String?) -> String { + guard let code, !code.isEmpty else { + return localized( + "chat.artifact.failure.unknown.message", + defaultValue: "The Mac reported an error this version of cmux doesn't recognize. Try again, then update cmux on both devices." + ) + } + let format = localized( + "chat.artifact.failure.unknown.coded_message", + defaultValue: "The Mac reported an error this version of cmux doesn't recognize (%@). Try again, then update cmux on both devices." + ) + return String.localizedStringWithFormat(format, code) + } + private static func tooLargeMessage(actualSize: Int64?, limit: Int64) -> String { let limitText = ByteCountFormatter.string(fromByteCount: limit, countStyle: .file) guard let actualSize else { diff --git a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactInlineViewer.swift b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactInlineViewer.swift index b0c6afac4676..31afaf54743c 100644 --- a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactInlineViewer.swift +++ b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactInlineViewer.swift @@ -165,6 +165,8 @@ public struct ChatArtifactInlineViewer: View { .chat case .terminal: .terminal + case .panel: + .panel case .workspaceChanges: .workspaceChanges case .unsupported: diff --git a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactViewerModel.swift b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactViewerModel.swift index a9918cf7d0f0..2776b6372bb1 100644 --- a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactViewerModel.swift +++ b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactViewerModel.swift @@ -339,7 +339,7 @@ final class ChatArtifactViewerModel { await temporaryFileStore.remove(temporaryFileURL) } - private static func state( + static func state( for error: any Error, stat: ChatArtifactStat? ) -> ChatArtifactViewerState { diff --git a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Resources/Localizable.xcstrings b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Resources/Localizable.xcstrings index febcf4b84000..bfea9fa170b1 100644 --- a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Resources/Localizable.xcstrings +++ b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Resources/Localizable.xcstrings @@ -330,6 +330,27 @@ "ja": { "stringUnit": { "state": "translated", "value": "転送が中断されました" } } } }, + "chat.artifact.failure.unknown.coded_message": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", "value": "The Mac reported an error this version of cmux doesn't recognize (%@). Try again, then update cmux on both devices." } }, + "ja": { "stringUnit": { "state": "translated", "value": "Macがこのバージョンのcmuxでは認識できないエラーを報告しました(%@)。再試行し、両方のデバイスでcmuxをアップデートしてください。" } } + } + }, + "chat.artifact.failure.unknown.message": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", "value": "The Mac reported an error this version of cmux doesn't recognize. Try again, then update cmux on both devices." } }, + "ja": { "stringUnit": { "state": "translated", "value": "Macがこのバージョンのcmuxでは認識できないエラーを報告しました。再試行し、両方のデバイスでcmuxをアップデートしてください。" } } + } + }, + "chat.artifact.failure.unknown.title": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", "value": "Unexpected error" } }, + "ja": { "stringUnit": { "state": "translated", "value": "予期しないエラー" } } + } + }, "chat.artifact.failure.unsupported.message": { "extractionState": "manual", "localizations": {