fix: keep chunk details out of speaker headers

Render transcript-wide speaker numbers instead of exposing upload chunks in
reader-facing headers. Reconcile adjacent requests using at least two
unambiguous word-and-time matches in their shared audio, including when
provider speaker IDs change between requests. Reject conflicting mappings
and never treat matching numeric provider IDs as identity evidence.

Assign fresh IDs where continuity cannot be established and report that
uncertainty on stderr. Number only speakers retained after overlap trimming.
Document that overlap matching cannot identify a returning speaker who was
absent from the overlap, and add the reader-facing boundary to AGENTS.md.

Test Plan:
- python3 -B -m unittest -v: all 46 tests passed, including swapped IDs,
  ambiguous evidence, continuity across three requests, and plain headers.
- git diff --cached --check: passed.
- Tests use synthetic speaker labels; live diarization accuracy was not
  verified because provider credentials are unavailable in this environment.
This commit is contained in:
ddidderr committed 2026-09-12 09:30:46 +02:00
1 parent 6e94379a25
commit 5dd1b5811b
7 files changed
+129 -32

No files matched your search

+7 -6
View File
@@ -92,16 +92,17 @@ class TranscribeTests(unittest.TestCase):
self.assertEqual(result.stderr, "")
self.assert_cleaned()
def test_chunked_text_prints_speaker_ids_with_request_scope(self):
def test_chunked_text_has_speaker_markers_without_chunk_details(self):
result = self.run_cli("--chunk-minutes", "1", mode="speakers")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout, (
"[Chunk 1, Speaker 0]\nHello.\n\n"
"[Chunk 1, Speaker 0]\nboundary\n\n"
"[Chunk 2, Speaker 1]\ncontinues.\n\n"
"[Chunk 2, Speaker 1]\nLast.\n"
"[Speaker 0]\nHello.\n\n"
"[Speaker 0]\nboundary\n\n"
"[Speaker 1]\ncontinues.\n\n"
"[Speaker 1]\nLast.\n"
))
self.assertNotIn("Warning", result.stderr)
self.assertIn("speaker continuity is uncertain", result.stderr)
self.assertNotIn("Chunk", result.stdout)
self.assert_cleaned()
def test_missing_speaker_labels_warn_instead_of_implying_detection_worked(self):