Phase 9 of the rebrand cascade. Sweep covers everything the Phase 8
frontend pass deliberately skipped: docs/, root markdown, scripts,
Cargo.toml descriptions, code comments that survived earlier
word-boundary sed, plus a handful of identifiers caught on the final
verify pass.
transcription-app changes:
- README.md, HANDOVER.md, KNOWN-ISSUES.md, run.sh — magnotia/Magnotia
-> lumotia/Lumotia.
- docs/ — sweep across all subdirs except docs/handovers/ (preserved
as immutable audit trail). Includes architecture-map references
to magnotia_core::*, magnotia_storage::*, etc. now pointing at
lumotia_*; dev-setup.md tracing output examples (lumotia_startup
target); brief/ + superpowers/ + issues/ + whisper-ecosystem/ +
audit/.
- Cargo.toml descriptions on 9 crates (core, audio, cloud-providers,
hotkey, llm, mcp, plus referenced others).
- crates/core/src/{error,hardware,recommendation,paths}.rs +
crates/audio/src/wav.rs + crates/llm/src/model_manager.rs +
crates/cloud-providers/src/keystore.rs + crates/mcp/src/lib.rs —
doc comments and a model-manager user-agent string.
- Caught on final pass: BroadcastChannel("magnotia_task_sync") -> ...
("lumotia_task_sync"); magnotia_locale i18n localStorage key
renamed + migration shim added; CSS keyframe names
magnotiaPulse / magnotiaBar / magnotiaFade renamed in the design-
system kit; magnotia_viewer_item / magnotia_viewer_mode handoff
keys renamed in HistoryPage + viewer/+page.svelte; src/assets/
wordmark.svg text.
- src-tauri/src/lib.rs comment cleanup ("magnotia era" was sed'd
to "lumotia era" earlier — restored).
Preserved (intentional):
- crates/core/src/paths.rs — keeps "magnotia" / "Magnotia" / ".magnotia"
legacy detection strings in legacy_and_target_paths() so the
migration shim can still find user data from the magnotia era.
- src/lib/stores/{page,focusTimer}.svelte.ts + src/lib/i18n/index.ts
— migration call sites reference the legacy magnotia keys
deliberately.
- docs/handovers/ — historical audit trail.
cargo build --workspace passes. npm run check: 0 errors / 0 warnings
(3958 files). cargo test --workspace: 339 pass / 0 fail.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.6 KiB
3.6 KiB
name, type, slice, last_verified
| name | type | slice | last_verified |
|---|---|---|---|
| Inference concurrency (run_inference) | architecture-map-page | 03-audio-transcription | 2026/05/09 |
Inference concurrency
Where you are: Architecture map → Audio + Transcription → Inference concurrency
Plain English summary. Whisper and Parakeet inference is synchronous and CPU-bound (or GPU-bound through Vulkan). Running it on the Tokio runtime would block the executor, so every async caller goes through run_inference, a thin wrapper that hands the work to tokio::task::spawn_blocking. Callers never see the Arc<LocalEngine> lock or the spawn boundary; they await a TimedTranscript.
At a glance
- Crate:
lumotia-transcription - Path:
crates/transcription/src/concurrency.rs - LOC: 19
- External deps:
tokio(rt feature forspawn_blocking). - Internal callers (best effort, slice 2 reconciles):
src-tauri/src/commands/transcription.rs(file path),src-tauri/src/commands/live.rs(per-chunk during live capture).
Public surface:
pub async fn run_inference(engine: Arc<LocalEngine>, audio: AudioSamples, options: TranscriptionOptions) -> Result<TimedTranscript>—crates/transcription/src/concurrency.rs:11.
What's in here
The whole file:
pub async fn run_inference(
engine: Arc<LocalEngine>,
audio: AudioSamples,
options: TranscriptionOptions,
) -> Result<TimedTranscript> {
tokio::task::spawn_blocking(move || engine.transcribe_sync(&audio, &options))
.await
.map_err(|e| MagnotiaError::TranscriptionFailed(format!("Task join error: {e}")))?
}
engine is shared via Arc (the engine itself uses an internal mutex for inference / load serialisation). audio and options are moved into the closure. The double ? flattens the join-error layer with the inference-error layer.
Data flow
async caller
└─ run_inference(engine, audio, options)
└─ tokio::task::spawn_blocking(move || engine.transcribe_sync(...))
└─ LocalEngine internal mutex → Transcriber::transcribe_sync
→ Vec<Segment> + inference_ms
→ Result<TimedTranscript>
.await + map_err(JoinError → MagnotiaError::TranscriptionFailed)
Watch-outs
spawn_blockingis the only place inference runs. Anyone writing a new caller that callsLocalEngine::transcribe_syncdirectly from an async context will block the Tokio executor. Always go throughrun_inference.Arc<LocalEngine>is the contract. The function takes anArc, not&LocalEngine, because the engine must outlive the spawned task. The shared state in slice 2 holds the engine inside anArc.- Audio and options are moved. They are not borrowed across the spawn boundary; the caller hands ownership over.
- JoinError is the only failure mode added by this layer.
MagnotiaError::TranscriptionFailed("Task join error: ...")indicates a panic insidetranscribe_syncor a runtime shutdown. The actual inference errors flow through the innerResult. - No backpressure here. Callers issuing many concurrent
run_inferencecalls each spawn an independent blocking task. Tokio's default blocking thread pool is 512 threads, but theLocalEnginemutex serialises them — only one will actually run inference at a time. Worth knowing if you ever look at thread counts in a profiler.
See also
- Transcription engines overview —
LocalEngine::transcribe_syncis what runs inside the blocking task. - Transcription streaming — live capture invokes
run_inferenceper chunk.