Skip to content

Add @unknown default: to Transcript.Entry/Segment switches (macOS 27 SDK compat) - #8

Open
srirsiva wants to merge 1 commit into
dmakwt:mainfrom
srirsiva:fix/macos-27-unknown-default-cases
Open

Add @unknown default: to Transcript.Entry/Segment switches (macOS 27 SDK compat)#8
srirsiva wants to merge 1 commit into
dmakwt:mainfrom
srirsiva:fix/macos-27-unknown-default-cases

Conversation

@srirsiva

Copy link
Copy Markdown

Problem

macOS 27 SDK adds new cases to Transcript.Entry and Transcript.Segment that aren't present in macOS 26. The two non-exhaustive switches in FoundationModelsFrameworkPlugin.swift compile with warnings on macOS 26 but fail as hard errors on macOS 27, blocking every fresh macOS build:

FoundationModelsFrameworkPlugin.swift:345:13: error: switch must be exhaustive
FoundationModelsFrameworkPlugin.swift:376:9: error: switch must be exhaustive

Fix

Adds @unknown default: to both switches on iOS and macOS. The same file already uses this pattern for SystemLanguageModel.Availability.UnavailableReason (lines 392, 406) — this just extends the pattern to the other two Apple enums so future SDK additions don't break the build again.

Defaults:

  • Transcript.Entry unknown case → role = "unknown", content and segments = String(describing: entry) so the transcript stays lossless.
  • Transcript.Segment unknown case → String(describing: segment), same intent.

Platforms

  • ✅ macOS: was hard-erroring, now builds clean.
  • ✅ iOS: iOS 27 SDK doesn't add new cases yet, so iOS was already fine — patched for forward-compat symmetry only.

Verified locally by building a real macOS Flutter target (flutter build macos --release) against Xcode 27 / macOSX27.0.sdk — build now succeeds.

🤖 Generated with Claude Code

… 27 SDK compat)

macOS 27 SDK adds new cases to Transcript.Entry and Transcript.Segment
that are absent from macOS 26 — the two non-exhaustive switches in
FoundationModelsFrameworkPlugin.swift compile with warnings on macOS 26
but fail as errors on macOS 27 ("switch must be exhaustive"), breaking
every fresh macOS build.

Adds @unknown default: to both switches on iOS and macOS. The same file
already uses this pattern for SystemLanguageModel.Availability.
UnavailableReason (lines 392, 406) — this just extends the pattern to
the other two frozen-but-actually-evolving Apple enums so future SDK
additions won't break the build again.

- Transcript.Entry unknown case → role="unknown", content/segments =
  String(describing: entry) so the transcript stays lossless.
- Transcript.Segment unknown case → String(describing: segment), same
  intent.

iOS 27 SDK doesn't add new cases (yet), so iOS builds fine either way;
patching both platforms for forward-compat symmetry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants