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,31 @@
**Path:** `src-tauri/src/commands/live.rs:193-338`
**Source:** [2026-04-22 code review](../code-review-2026-04-22.md#c1--racy-single-session-guard-in-livers)
**Labels:** release-blocker, critical, concurrency
**Status:** RESOLVED (2026-04-22)
## Resolution
`LiveTranscriptionState` now includes a dedicated
`tokio::sync::Mutex<()>` lifecycle gate. Both
`start_live_transcription_session` and
`stop_live_transcription_session` acquire that async mutex before
touching `running`, and they keep it held across the awaited setup /
join work that previously exposed the race windows.
That changes the two failing interleavings from the review:
- Two overlapping starts no longer race through the empty-slot check.
The second call waits for the first to finish setup, then observes
`running.is_some()` and returns the existing
`"A live transcription session is already running"` error.
- A start launched during stop can no longer sneak in after
`running.take()` but before the previous worker has fully joined.
It blocks on the lifecycle mutex until the join completes.
Regression tests in `commands::live::tests`:
- `concurrent_starts_allow_only_one_session_to_claim_the_slot`
- `start_waits_for_stop_to_finish_joining_before_reusing_slot`
## Problem
@@ -26,4 +51,4 @@ Large. Will likely require the `run_live_session` monolith refactor (RB-04) to l
## Dependencies
- **Blocked by:** RB-04 (`run_live_session` monolith refactor)
- Landed after RB-04 (`run_live_session` refactor) made the worker lifecycle explicit enough to guard safely.