Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

test(voice): recognition checklist + anti-drift honesty-coverage guard

Ruben Lütke547c1e2956c0
diff --git a/tests/unit/brain/test_voice_command_checklist.py b/tests/unit/brain/test_voice_command_checklist.py
new file mode 100644
index 0000000000..2a46438465
--- /dev/null
+++ b/tests/unit/brain/test_voice_command_checklist.py
@@ -0,0 +1,47 @@
+"""Runs the whole recognition checklist, and guards that every command KIND the
+gate can emit has a matching honesty test — so a new deterministic command
+cannot be added without an honest readback (the audit 2026-06-27 root class).
+"""
+from __future__ import annotations
+
+import typing
+
+import pytest
+
+from jarvis.brain.voice_command_gate import VoiceCommandMatch, match_voice_command
+
+from tests.unit.brain.voice_command_cases import RECOGNITION_CASES
+
+
[email protected]("utterance,kind,target", RECOGNITION_CASES)
+def test_recognition_checklist(utterance: str, kind: str, target: str) -> None:
+ m = match_voice_command(utterance)
+ assert m is not None, f"not recognised: {utterance!r}"
+ assert m.kind == kind, f"{utterance!r}: expected {kind}, got {m.kind}"
+ if target:
+ assert m.target == target, f"{utterance!r}: expected target {target!r}, got {m.target!r}"
+
+
+def test_every_command_kind_has_an_honesty_test() -> None:
+ """Anti-drift: the set of kinds the gate can emit must equal the set we have
+ deliberately given an honest readback. Adding a new kind to the gate without
+ updating this guard (and adding an honesty test) fails here — the structural
+ insurance against a new silent/blind command."""
+ # The kinds the gate's Literal can emit (single source of truth). get_type_hints
+ # resolves the string annotation (from __future__ import annotations) to the
+ # real Literal so get_args returns the values.
+ hints = typing.get_type_hints(VoiceCommandMatch)
+ gate_kinds = set(typing.get_args(hints["kind"]))
+ # The kinds we have audited and given an honest readback (2026-06-27).
+ audited_kinds = {
+ "provider_switch",
+ "subagent_switch",
+ "language_switch",
+ "cancel",
+ "depth_deep",
+ "depth_fast",
+ }
+ assert gate_kinds == audited_kinds, (
+ "voice command kinds drifted — a new kind needs an honest readback + an "
+ f"honesty test. gate={sorted(gate_kinds)} audited={sorted(audited_kinds)}"
+ )
diff --git a/tests/unit/brain/voice_command_cases.py b/tests/unit/brain/voice_command_cases.py
new file mode 100644
index 0000000000..cad945175f
--- /dev/null
+++ b/tests/unit/brain/voice_command_cases.py
@@ -0,0 +1,32 @@
+"""The growing voice-command recognition checklist — real utterances the gate
+MUST classify correctly. Add a case here whenever a phrasing is mis-recognised
+in the field; the checklist test then guards it forever. (utterance, kind, target);
+target is "" for kinds with no target (cancel, depth_deep, depth_fast).
+"""
+from __future__ import annotations
+
+# (utterance, expected kind, expected target)
+RECOGNITION_CASES: list[tuple[str, str, str]] = [
+ # provider_switch
+ ("wechsel auf gemini", "provider_switch", "gemini"),
+ ("switch to openai", "provider_switch", "openai"),
+ ("wechsel von gemini auf openai", "provider_switch", "openai"),
+ ("switch from claude to gemini", "provider_switch", "gemini"),
+ ("nutze chatgpt", "provider_switch", "chatgpt"),
+ ("switch to anthropic", "provider_switch", "anthropic"),
+ ("ändere den Provider auf gemini", "provider_switch", "gemini"), # i18n-allow: fixture
+ ("stell den Provider auf claude", "provider_switch", "claude"), # i18n-allow: fixture
+ # subagent_switch
+ ("stell den subagent provider auf gemini", "subagent_switch", "gemini"),
+ ("stell den subagent provider von antigravity auf codex um", "subagent_switch", "codex"), # i18n-allow: fixture
+ # language_switch
+ ("stell auf Englisch um", "language_switch", "en"), # i18n-allow: fixture
+ ("antworte auf deutsch und englisch", "language_switch", "de"), # i18n-allow: fixture
+ ("respond in German", "language_switch", "de"),
+ # cancel
+ ("jarvis stopp", "cancel", ""),
+ ("halt", "cancel", ""),
+ # depth
+ ("denk gründlich", "depth_deep", ""), # i18n-allow: fixture
+ ("nimm haiku", "depth_fast", ""),
+]