Skip to content

test(cli): pin the tts --multi-speaker request shape - #72

Merged
2ynn merged 1 commit into
mainfrom
test/bb1
Oct 6, 2026
Merged

2ynn merged 1 commit into
mainfrom
test/bb1

Conversation

@2ynn

@2ynn 2ynn commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Contract tests for the multi-speaker input introduced in #71 (1f78c8a). The only file this PR changes is tests/contract/tts_test.go.

Assertions follow #71's behaviour, where the <Speaker>: label is removed from the turn text (hi., yo.), not kept (Alice: hi.) as in the earlier draft of the fix.

  • TestTTSMultiSpeakerInput: on the default model, one text block per turn annotated with speech_metadata naming its speaker, label removed. On gemini-3.1-flash-tts-preview and models/gemini-3.1-flash-tts-preview, one plain block.
  • TestTTSMultiSpeakerScriptFile: a Windows-saved -f script (UTF-8 byte-order mark, CRLF) splits into hi. / yo..
  • TestTTSMultiSpeakerRejectsUnlabelledText: text before the first label exits 2 with text before the first speaker label: "Intro.", and no request is sent.

go test ./tests/contract/ passes on this branch.

@2ynn
2ynn requested a review from a team October 6, 2026 21:31

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces multi-speaker script parsing and annotation support for TTS models, splitting scripts into individual speaker turns for modern models while preserving plain text blocks for legacy ones. It also adds a utility to strip UTF-8 BOMs from input files. The feedback suggests adding defensive checks to prevent potential nil pointer dereferences when handling speech configurations and to handle empty speaker lists gracefully to avoid malformed regular expressions.

Comment thread internal/cli/custom/tts.go
Comment thread internal/cli/custom/tts.go
@2ynn
2ynn force-pushed the test/bb1 branch 2 times, most recently from bd3b523 to 02ee6f6 Compare October 6, 2026 22:39
Contract tests for the annotated multi-speaker input: one text block per
turn with its speech_metadata speaker and the label removed on current
models, one plain block on legacy ones (also via a `models/` id), a
Windows-saved -f script (byte-order mark, CRLF) splitting into turns,
and text before the first label failing locally with exit 2 and no
request sent.
@2ynn
2ynn merged commit d63744d into main Oct 6, 2026
8 checks passed
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