Two bugs in ensureLinuxReady():
1. Branch ordering: "ModuleNotFoundError: No module named 'sounddevice'"
contains the word "sounddevice", so the portaudio branch matched first,
producing the misleading "install libportaudio2" message even when
libportaudio2 was already installed.
2. No venv auto-creation: On PEP 668 systems (Ubuntu 23.10+), system pip
is blocked. The code trusted speech-recognizer.py to self-install deps,
but its pip install also fails. Now ensureLinuxReady() auto-creates
~/.gsd/voice-venv when the sounddevice module is missing.
Fixes:
- Extract diagnoseSounddeviceError() with correct branch ordering
(check "No module"/"ModuleNotFoundError" BEFORE "sounddevice")
- Add ensureVoiceVenv() to auto-create venv with sounddevice+requests
- Refactor into linux-ready.ts for testability
- Add 20 unit tests covering all error diagnosis paths and venv creation
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>