[P1] ZARA-011 — Fix dictation phrase corruption, output ordering, and cleanup #12

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

Problem

The canonical and script dictation implementations have diverged. In zara/dictate.py, a missing comma concatenates "end dictation" "disable" into one phrase, so intended stop words are absent.

Parallel transcription futures are emitted in completion order rather than audio sequence order, allowing later speech chunks to be typed before earlier chunks. Cleanup is not protected by a top-level finally, so PID files and global queues/events can remain stale after errors or zara --dictate interruption.

Required fix

  • Correct and centralize stop-phrase definitions.
  • Assign sequence numbers to chunks and commit text strictly in capture order while still permitting parallel transcription.
  • Guarantee process/PID/queue/thread cleanup in finally paths.
  • Reset per-run state so repeated in-process test runs are valid.
  • Do not reduce chunk duration or redesign streaming in this issue.

Required tests

  • Stop-phrase table tests including end dictation, disable, end quote, configured phrases, punctuation, and casing.
  • Deliberately complete fake futures out of order and prove typed output remains ordered.
  • Test exception, KeyboardInterrupt, queue overflow, and repeated start/stop cleanup.
  • Add scripts/test-dictation.sh using synthetic arrays and a fake typing sink.

Acceptance

  • No phrase is accidentally concatenated.
  • Typed output preserves spoken chunk order.
  • PID files, queues, threads, and executors are cleaned on every exit path.

Branch

fix/zara-011-dictation-ordering

Dependencies

ZARA-005.

## Problem The canonical and script dictation implementations have diverged. In `zara/dictate.py`, a missing comma concatenates `"end dictation" "disable"` into one phrase, so intended stop words are absent. Parallel transcription futures are emitted in completion order rather than audio sequence order, allowing later speech chunks to be typed before earlier chunks. Cleanup is not protected by a top-level `finally`, so PID files and global queues/events can remain stale after errors or `zara --dictate` interruption. ## Required fix - Correct and centralize stop-phrase definitions. - Assign sequence numbers to chunks and commit text strictly in capture order while still permitting parallel transcription. - Guarantee process/PID/queue/thread cleanup in `finally` paths. - Reset per-run state so repeated in-process test runs are valid. - Do not reduce chunk duration or redesign streaming in this issue. ## Required tests - Stop-phrase table tests including `end dictation`, `disable`, `end quote`, configured phrases, punctuation, and casing. - Deliberately complete fake futures out of order and prove typed output remains ordered. - Test exception, KeyboardInterrupt, queue overflow, and repeated start/stop cleanup. - Add `scripts/test-dictation.sh` using synthetic arrays and a fake typing sink. ## Acceptance - No phrase is accidentally concatenated. - Typed output preserves spoken chunk order. - PID files, queues, threads, and executors are cleaned on every exit path. ## Branch `fix/zara-011-dictation-ordering` ## Dependencies ZARA-005.
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#12
No description provided.