From dbb35ce71dbb47af5daa4a3ff0b2c0a257929f27 Mon Sep 17 00:00:00 2001 From: "thomas.kopp" Date: Thu, 2 Apr 2026 01:06:30 +0200 Subject: [PATCH] feat: AppState gains speaker pause fields and AWAITING_SPEAKERS status --- api/state.py | 7 ++++++- tests/test_api.py | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/api/state.py b/api/state.py index 289466c..7921d2c 100644 --- a/api/state.py +++ b/api/state.py @@ -8,15 +8,20 @@ class Status(str, Enum): IDLE = "idle" RECORDING = "recording" PROCESSING = "processing" + AWAITING_SPEAKERS = "awaiting_speakers" ERROR = "error" @dataclass class AppState: status: Status = Status.IDLE - recording_user: str | None = None # which user triggered the current recording + recording_user: str | None = None last_error: str | None = None _listeners: list[Callable] = field(default_factory=list, repr=False) + # Diarization pipeline pause + _speakers_event: asyncio.Event | None = None + _pending_aligned_segments: list[tuple[str, str]] | None = None + _speaker_names: dict[str, str] | None = None def subscribe(self, callback: Callable): self._listeners.append(callback) diff --git a/tests/test_api.py b/tests/test_api.py index 7b7a5a9..3c3a664 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -160,6 +160,17 @@ def test_status_includes_is_admin(): app.dependency_overrides.pop(current_user, None) +def test_state_has_speaker_fields(): + from api.state import AppState + s = AppState() + assert hasattr(s, "_speakers_event") + assert hasattr(s, "_pending_aligned_segments") + assert hasattr(s, "_speaker_names") + assert s._speakers_event is None + assert s._pending_aligned_segments is None + assert s._speaker_names is None + + def test_put_config_deep_merges(tmp_path, monkeypatch): import config as cfg_mod monkeypatch.setattr(cfg_mod, "CONFIG_PATH", str(tmp_path / "config.toml"))