Land release blocker fixes and workspace cleanup
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled

This commit is contained in:
2026-04-23 00:16:09 +01:00
parent d7363cc913
commit 9b0067b4c0
36 changed files with 1529 additions and 418 deletions

View File

@@ -4,6 +4,33 @@
**Path:** `src-tauri/src/commands/live.rs:349-579`
**Source:** [2026-04-22 code review](../code-review-2026-04-22.md)
**Labels:** release-blocker, major, refactor, concurrency
**Status:** RESOLVED (2026-04-22)
## Resolution
`run_live_session` was split around two explicit state holders:
- `ActiveCapture` owns the cpal stream handle, audio receiver, and
optional runtime-error channel.
- `LiveLoopState` owns the mutable per-session loop state: resampler,
capture buffer, WAV writer, buffer offsets, dropped-audio accounting,
in-flight inference task, and duplicate-history buffer.
The top-level worker is now `LiveSessionRuntime`, with focused methods
for:
- polling in-flight inference
- draining microphone runtime warnings
- receiving + resampling an audio chunk
- dropping pending-buffer overflow
- flushing the resampler tail when stop is requested
- dispatching inference when enough audio is buffered
- draining the last in-flight task
- finalising the progressive WAV writer
This keeps behaviour intact but removes the "everything in one mutable
loop" shape that made concurrency review hard. The refactor also made
RB-01 straightforward enough to land immediately afterward.
## Problem