From 0897e0adb8d773dec4e47bafce5978ea79ef1d87 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 28 Jul 2026 09:34:46 -0700 Subject: [PATCH] test: align dispatch tests with provider-scoped validation and named registration errors Follow-ups for the salvaged wave: the auto-detect legacy-error test now stubs the split validators, the unknown-command-provider test expects the new provider_not_registered error, and _transcribe_local tolerates a null stt.local config section again. --- tests/tools/test_transcription_command_providers.py | 5 ++++- tests/tools/test_transcription_plugin_dispatch.py | 2 ++ tools/transcription_tools.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_transcription_command_providers.py b/tests/tools/test_transcription_command_providers.py index 10d6e9b332a8..f496bfe3bfe7 100644 --- a/tests/tools/test_transcription_command_providers.py +++ b/tests/tools/test_transcription_command_providers.py @@ -528,7 +528,10 @@ class TestTranscribeAudioDispatchToCommandProvider: with patch("tools.transcription_tools._load_stt_config", return_value=cfg): result = transcribe_audio(str(audio)) assert result["success"] is False - assert "No STT provider available" in result["error"] + # Explicitly-configured unknown providers now get a named + # registration error instead of the generic legacy message. + assert result["error_type"] == "provider_not_registered" + assert "unknown-cli" in result["error"] # --------------------------------------------------------------------------- diff --git a/tests/tools/test_transcription_plugin_dispatch.py b/tests/tools/test_transcription_plugin_dispatch.py index 7bfd311de1a8..fa8b6db4c9fc 100644 --- a/tests/tools/test_transcription_plugin_dispatch.py +++ b/tests/tools/test_transcription_plugin_dispatch.py @@ -256,6 +256,8 @@ class TestTranscribeAudioE2E: from unittest.mock import patch with patch("tools.transcription_tools._validate_audio_file", return_value=None), \ + patch("tools.transcription_tools._validate_audio_source_file", return_value=None), \ + patch("tools.transcription_tools._validate_audio_file_size", return_value=None), \ patch("tools.transcription_tools._load_stt_config", return_value={}), \ patch("tools.transcription_tools.is_stt_enabled", return_value=True), \ patch("tools.transcription_tools._get_provider", return_value="none"): diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py index f9e14e64a65e..78b757bf497a 100644 --- a/tools/transcription_tools.py +++ b/tools/transcription_tools.py @@ -1399,7 +1399,7 @@ def _transcribe_local(file_path: str, model_name: str) -> Dict[str, Any]: return {"success": False, "transcript": "", "error": "faster-whisper not installed"} try: - local_cfg = _load_stt_config().get("local", {}) + local_cfg = _load_stt_config().get("local") or {} # Lazy-load the model (downloads on first use, ~150 MB for 'base'). # Double-checked lock: concurrent voice messages must not both # download/load the model (#24767).