[P0] ZARA-001 — Restore the canonical wake entrypoint and make it importable #2

Closed
opened 2026-07-18 19:17:51 +00:00 by lost-rob0t · 0 comments
lost-rob0t commented 2026-07-18 19:17:51 +00:00 (Migrated from github.com)

Problem

zara/wake.py::WakeWordListener.active_mode_async contains a duplicated, unexpectedly indented audio-capture block. The module cannot be imported, so zara --wake and the Nix zara-wake wrapper are blocked before runtime.

The legacy scripts/zara_wake.py is not a safe fallback: helper functions added for sample-rate handling are defined after if __name__ == "__main__": main(), so direct execution can call _get_input_sample_rate() before it exists.

Required fix

  • Repair zara/wake.py so it parses and has exactly one active-command capture path.
  • Treat zara/wake.py as the canonical implementation.
  • Make the script wrapper import/delegate to the canonical module or remove it in the later consolidation issue.
  • Preserve Prolog-first routing and current configuration behavior; do not optimize latency here.

Required tests

  • Add t/test_wake_import.py that imports zara.wake without opening audio hardware.
  • Add a state-machine unit test proving active_mode_async reaches the command capture path once, not twice.
  • Add scripts/test-entrypoints.sh with at least:
    • python -m compileall -q zara scripts
    • python -c 'import zara.wake'
    • python -m zara --help
  • Mock Whisper, sounddevice, Prolog, memory, notifications, and TTS; tests must not require a microphone, network, model download, or desktop session.

Acceptance

  • nix develop -c pytest passes.
  • nix develop -c bash scripts/test-entrypoints.sh passes.
  • nix build still succeeds.

Branch

fix/zara-001-wake-entrypoint

Dependencies

None. This is the first repair issue.

## Problem `zara/wake.py::WakeWordListener.active_mode_async` contains a duplicated, unexpectedly indented audio-capture block. The module cannot be imported, so `zara --wake` and the Nix `zara-wake` wrapper are blocked before runtime. The legacy `scripts/zara_wake.py` is not a safe fallback: helper functions added for sample-rate handling are defined after `if __name__ == "__main__": main()`, so direct execution can call `_get_input_sample_rate()` before it exists. ## Required fix - Repair `zara/wake.py` so it parses and has exactly one active-command capture path. - Treat `zara/wake.py` as the canonical implementation. - Make the script wrapper import/delegate to the canonical module or remove it in the later consolidation issue. - Preserve Prolog-first routing and current configuration behavior; do not optimize latency here. ## Required tests - Add `t/test_wake_import.py` that imports `zara.wake` without opening audio hardware. - Add a state-machine unit test proving `active_mode_async` reaches the command capture path once, not twice. - Add `scripts/test-entrypoints.sh` with at least: - `python -m compileall -q zara scripts` - `python -c 'import zara.wake'` - `python -m zara --help` - Mock Whisper, sounddevice, Prolog, memory, notifications, and TTS; tests must not require a microphone, network, model download, or desktop session. ## Acceptance - `nix develop -c pytest` passes. - `nix develop -c bash scripts/test-entrypoints.sh` passes. - `nix build` still succeeds. ## Branch `fix/zara-001-wake-entrypoint` ## Dependencies None. This is the first repair issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/zara#2
No description provided.