Add container diarization configuration

This commit is contained in:
2026-08-24 15:59:18 +02:00
parent 2a4481f2f9
commit 303563abf1
8 changed files with 152 additions and 5 deletions
+44 -3
View File
@@ -1,5 +1,5 @@
import json
from dataclasses import dataclass
from dataclasses import dataclass, replace
from datetime import date
from pathlib import Path
from types import SimpleNamespace
@@ -74,7 +74,15 @@ class FakeMeetingLab:
)
if self.fail:
(self.run_dir / "run_metadata.json").write_text(
json.dumps({"failure": {"stage": "whisper", "message": "model failed"}}),
json.dumps(
{
"failure": {
"stage": "whisper",
"type": "TranscriptionError",
"message": "model failed",
}
}
),
encoding="utf-8",
)
progress_sink(
@@ -211,6 +219,8 @@ def test_process_translates_configuration_and_disables_diarization(
assert gateway.config_values["whisper_executable"] == "/opt/whisper-cli"
assert gateway.config_values["ffmpeg_executable"] == "ffmpeg"
assert gateway.config_values["audio_normalization"] is True
assert gateway.config_values["diarization_runtime"] == "native"
assert gateway.config_values["diarization_container_args"] == ()
assert gateway.config_values["output_root"] == (
tmp_path / "meetings" / "architecture-review" / "runs"
)
@@ -260,6 +270,37 @@ def test_process_propagates_enabled_diarization_and_progress(tmp_path: Path) ->
assert events[2].progress == 0.25
def test_process_propagates_ordered_diarization_container_args(tmp_path: Path) -> None:
service, gateway = make_service(tmp_path)
service.settings = replace(
service.settings,
diarization_runtime="container",
diarization_container_image="runtime/image:tag",
diarization_container_args=(
"--network=host",
"--label",
"meeting-test",
),
)
audio = tmp_path / "meeting.wav"
audio.write_bytes(b"audio")
outcome = service.process(
audio,
meeting(),
participants(),
ProcessingOptions(diarization_enabled=True),
)
assert outcome.succeeded
assert gateway.config_values is not None
assert gateway.config_values["diarization_container_args"] == (
"--network=host",
"--label",
"meeting-test",
)
def test_result_and_user_edit_are_preserved_separately(tmp_path: Path) -> None:
service, _ = make_service(tmp_path)
audio = tmp_path / "meeting.wav"
@@ -283,7 +324,7 @@ def test_failure_reports_stage_and_preserves_run_dir(tmp_path: Path) -> None:
assert not outcome.succeeded
assert outcome.failed_stage == "transcription"
assert outcome.error_message == "model failed"
assert outcome.error_message == "TranscriptionError: model failed"
assert outcome.run_dir == gateway.run_dir
assert (gateway.run_dir / "run_metadata.json").is_file()