From 1fc2ade33b72dd299fc987943ddd09dee7c609ad Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 2 Apr 2026 17:37:20 +0300 Subject: task 002: restore Gemini fallback output and add failure coverage --- internal/audio/fallbacks.go | 1 - internal/audio/voices_test.go | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'internal/audio') diff --git a/internal/audio/fallbacks.go b/internal/audio/fallbacks.go index bd0c86e..0c3ed83 100644 --- a/internal/audio/fallbacks.go +++ b/internal/audio/fallbacks.go @@ -22,7 +22,6 @@ func RunWithVoiceFallbacks(initialVoice string, generate func(voice string) erro } lastErr = err - fmt.Printf("Warning: Gemini returned no audio for voice %s\n", voice) } return "", fmt.Errorf("Gemini returned no audio for voices %s: %w", strings.Join(attempted, ", "), lastErr) diff --git a/internal/audio/voices_test.go b/internal/audio/voices_test.go index 5e940d0..3d936d1 100644 --- a/internal/audio/voices_test.go +++ b/internal/audio/voices_test.go @@ -105,4 +105,24 @@ func TestRunWithVoiceFallbacks(t *testing.T) { t.Fatalf("attempted voices = %#v, want %#v", got, want) } }) + + t.Run("wraps exhausted Gemini voices", func(t *testing.T) { + var attempted []string + usedVoice, err := RunWithVoiceFallbacks("Charon", func(voice string) error { + attempted = append(attempted, voice) + return ErrGeminiNoAudioData + }) + if !errors.Is(err, ErrGeminiNoAudioData) { + t.Fatalf("error = %v, want wrapped ErrGeminiNoAudioData", err) + } + if usedVoice != "" { + t.Fatalf("used voice = %q, want empty", usedVoice) + } + if got, want := attempted, []string{"Charon", "Kore", "Leda"}; !reflect.DeepEqual(got, want) { + t.Fatalf("attempted voices = %#v, want %#v", got, want) + } + if got := err.Error(); got != "Gemini returned no audio for voices Charon, Kore, Leda: no audio data returned from Gemini" { + t.Fatalf("error text = %q, want wrapped attempted-voices summary", got) + } + }) } -- cgit v1.2.3