agent: lumotia-rebrand — drop MagnotiaError prefix, now lumotia_core::Error
Phase 3 of the rebrand cascade per locked decision D4. MagnotiaError -> Error in crates/core/src/error.rs (the crate name already qualifies it). 92 usages across 14 .rs files renamed via word-boundary sed. One collision required disambiguation: lumotia_storage already had its own local Error type (introduced by the slop-pass Area A residuals work). crates/storage/src/error.rs aliases the imported core error as CoreError on import; the From<Error> for CoreError boundary impl and the CoreError::Storage construction site use the alias. cargo build --workspace passes. cargo test --workspace: 330 pass, 0 fail. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use lumotia_core::error::{MagnotiaError, Result};
|
||||
use lumotia_core::error::{Error, Result};
|
||||
use lumotia_core::types::{AudioSamples, TranscriptionOptions};
|
||||
|
||||
use crate::local_engine::{LocalEngine, TimedTranscript};
|
||||
@@ -14,5 +14,5 @@ pub async fn run_inference(
|
||||
) -> Result<TimedTranscript> {
|
||||
tokio::task::spawn_blocking(move || engine.transcribe_sync(&audio, &options))
|
||||
.await
|
||||
.map_err(|e| MagnotiaError::TranscriptionFailed(format!("Task join error: {e}")))?
|
||||
.map_err(|e| Error::TranscriptionFailed(format!("Task join error: {e}")))?
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::time::Instant;
|
||||
|
||||
use transcribe_rs::{SpeechModel, TranscribeOptions, TranscriptionResult};
|
||||
|
||||
use lumotia_core::error::{MagnotiaError, Result};
|
||||
use lumotia_core::error::{Error, Result};
|
||||
use lumotia_core::types::{
|
||||
AudioSamples, EngineName, ModelId, Segment, Transcript, TranscriptionOptions,
|
||||
};
|
||||
@@ -48,7 +48,7 @@ impl Transcriber for SpeechModelAdapter {
|
||||
let result: TranscriptionResult = self
|
||||
.0
|
||||
.transcribe(samples, &opts)
|
||||
.map_err(|e| MagnotiaError::TranscriptionFailed(e.to_string()))?;
|
||||
.map_err(|e| Error::TranscriptionFailed(e.to_string()))?;
|
||||
Ok(result
|
||||
.segments
|
||||
.unwrap_or_default()
|
||||
@@ -140,7 +140,7 @@ impl LocalEngine {
|
||||
options: &TranscriptionOptions,
|
||||
) -> Result<TimedTranscript> {
|
||||
let mut guard = self.engine.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let backend = guard.as_mut().ok_or(MagnotiaError::EngineNotLoaded)?;
|
||||
let backend = guard.as_mut().ok_or(Error::EngineNotLoaded)?;
|
||||
|
||||
let start = Instant::now();
|
||||
let segments = backend.transcribe_sync(audio.samples(), options)?;
|
||||
@@ -197,7 +197,7 @@ impl transcribe_rs::SpeechModel for ParakeetWordGranularity {
|
||||
pub fn load_parakeet(model_dir: &Path) -> Result<Box<dyn Transcriber + Send>> {
|
||||
use transcribe_rs::onnx::Quantization;
|
||||
let model = transcribe_rs::onnx::parakeet::ParakeetModel::load(model_dir, &Quantization::Int8)
|
||||
.map_err(|e| MagnotiaError::TranscriptionFailed(format!("Failed to load Parakeet: {e}")))?;
|
||||
.map_err(|e| Error::TranscriptionFailed(format!("Failed to load Parakeet: {e}")))?;
|
||||
Ok(Box::new(SpeechModelAdapter(Box::new(
|
||||
ParakeetWordGranularity(model),
|
||||
))))
|
||||
@@ -207,7 +207,7 @@ pub fn load_parakeet(model_dir: &Path) -> Result<Box<dyn Transcriber + Send>> {
|
||||
#[cfg(feature = "whisper")]
|
||||
pub fn load_whisper(model_path: &Path) -> Result<Box<dyn Transcriber + Send>> {
|
||||
let backend = WhisperRsBackend::load(model_path)
|
||||
.map_err(|e| MagnotiaError::TranscriptionFailed(format!("Failed to load Whisper: {e}")))?;
|
||||
.map_err(|e| Error::TranscriptionFailed(format!("Failed to load Whisper: {e}")))?;
|
||||
Ok(Box::new(backend))
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::collections::HashSet;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{LazyLock, Mutex};
|
||||
|
||||
use lumotia_core::error::{MagnotiaError, Result};
|
||||
use lumotia_core::error::{Error, Result};
|
||||
use lumotia_core::model_registry::{find_model, ModelFile};
|
||||
use lumotia_core::types::{DownloadProgress, ModelId};
|
||||
|
||||
@@ -18,9 +18,9 @@ impl DownloadReservation {
|
||||
let id = id.as_str().to_string();
|
||||
let mut active = ACTIVE_DOWNLOADS
|
||||
.lock()
|
||||
.map_err(|_| MagnotiaError::DownloadFailed("download lock poisoned".into()))?;
|
||||
.map_err(|_| Error::DownloadFailed("download lock poisoned".into()))?;
|
||||
if !active.insert(id.clone()) {
|
||||
return Err(MagnotiaError::DownloadFailed(format!(
|
||||
return Err(Error::DownloadFailed(format!(
|
||||
"download already in progress for {id}"
|
||||
)));
|
||||
}
|
||||
@@ -80,7 +80,7 @@ pub async fn download(
|
||||
progress: impl Fn(DownloadProgress) + Send + 'static,
|
||||
) -> Result<()> {
|
||||
let _reservation = DownloadReservation::acquire(id)?;
|
||||
let entry = find_model(id).ok_or_else(|| MagnotiaError::ModelNotFound(id.clone()))?;
|
||||
let entry = find_model(id).ok_or_else(|| Error::ModelNotFound(id.clone()))?;
|
||||
|
||||
let dir = model_dir(id);
|
||||
std::fs::create_dir_all(&dir)?;
|
||||
@@ -98,7 +98,7 @@ pub async fn download(
|
||||
let _ = std::fs::remove_file(&dest);
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(MagnotiaError::DownloadFailed(format!(
|
||||
return Err(Error::DownloadFailed(format!(
|
||||
"failed to verify existing {}: {e}",
|
||||
file.filename
|
||||
)));
|
||||
@@ -196,7 +196,7 @@ async fn download_file(
|
||||
let client = reqwest::Client::builder()
|
||||
.connect_timeout(std::time::Duration::from_secs(30))
|
||||
.build()
|
||||
.map_err(|e| MagnotiaError::DownloadFailed(e.to_string()))?;
|
||||
.map_err(|e| Error::DownloadFailed(e.to_string()))?;
|
||||
|
||||
// Check for existing partial download (resume support)
|
||||
let existing_bytes = if part_path.exists() {
|
||||
@@ -215,7 +215,7 @@ async fn download_file(
|
||||
let response = request
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| MagnotiaError::DownloadFailed(e.to_string()))?;
|
||||
.map_err(|e| Error::DownloadFailed(e.to_string()))?;
|
||||
|
||||
// If we requested Range but the server returned 200 (full file), the
|
||||
// server does not support resume. Rather than blindly appending a
|
||||
@@ -237,14 +237,14 @@ async fn download_file(
|
||||
false
|
||||
}
|
||||
other => {
|
||||
return Err(MagnotiaError::DownloadFailed(format!(
|
||||
return Err(Error::DownloadFailed(format!(
|
||||
"resume request returned unexpected status {other}"
|
||||
)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if !response.status().is_success() {
|
||||
return Err(MagnotiaError::DownloadFailed(format!(
|
||||
return Err(Error::DownloadFailed(format!(
|
||||
"download returned HTTP {} for {}",
|
||||
response.status(),
|
||||
file.filename
|
||||
@@ -291,7 +291,7 @@ async fn download_file(
|
||||
}
|
||||
|
||||
while let Some(chunk) = stream.next().await {
|
||||
let chunk = chunk.map_err(|e| MagnotiaError::DownloadFailed(e.to_string()))?;
|
||||
let chunk = chunk.map_err(|e| Error::DownloadFailed(e.to_string()))?;
|
||||
std::io::Write::write_all(&mut out, &chunk)?;
|
||||
hasher.update(&chunk);
|
||||
downloaded += chunk.len() as u64;
|
||||
@@ -319,7 +319,7 @@ async fn download_file(
|
||||
let actual = format!("{:x}", hasher.finalize());
|
||||
if actual != file.sha256 {
|
||||
let _ = std::fs::remove_file(&part_path);
|
||||
return Err(MagnotiaError::DownloadFailed(format!(
|
||||
return Err(Error::DownloadFailed(format!(
|
||||
"SHA256 mismatch for {}: expected {}, got {}",
|
||||
file.filename, file.sha256, actual
|
||||
)));
|
||||
|
||||
@@ -22,7 +22,7 @@ use lumotia_cloud_providers::{
|
||||
CostClass, EngineProfile, ProviderCapabilities, ProviderId, ProviderKind, ProviderTranscript,
|
||||
TranscriptionProvider,
|
||||
};
|
||||
use lumotia_core::error::{MagnotiaError, Result};
|
||||
use lumotia_core::error::{Error, Result};
|
||||
use lumotia_core::types::{AudioSamples, TranscriptionOptions};
|
||||
|
||||
use crate::local_engine::LocalEngine;
|
||||
@@ -81,7 +81,7 @@ impl TranscriptionProvider for LocalProviderAdapter {
|
||||
if self.engine.is_loaded() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(MagnotiaError::EngineNotLoaded)
|
||||
Err(Error::EngineNotLoaded)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ impl TranscriptionProvider for LocalProviderAdapter {
|
||||
let engine = self.engine.clone();
|
||||
let timed = tokio::task::spawn_blocking(move || engine.transcribe_sync(&audio, &options))
|
||||
.await
|
||||
.map_err(|e| MagnotiaError::TranscriptionFailed(format!("Task join error: {e}")))??;
|
||||
.map_err(|e| Error::TranscriptionFailed(format!("Task join error: {e}")))??;
|
||||
Ok(ProviderTranscript {
|
||||
transcript: timed.transcript,
|
||||
inference_ms: timed.inference_ms,
|
||||
@@ -124,7 +124,7 @@ impl Orchestrator {
|
||||
pub fn resolve(&self, profile: &EngineProfile) -> Result<Arc<dyn TranscriptionProvider>> {
|
||||
self.registry
|
||||
.get(&profile.engine_id)
|
||||
.ok_or_else(|| MagnotiaError::ProviderNotRegistered(profile.engine_id.to_string()))
|
||||
.ok_or_else(|| Error::ProviderNotRegistered(profile.engine_id.to_string()))
|
||||
}
|
||||
|
||||
/// Transcribe audio using the provider named in the profile. The
|
||||
|
||||
@@ -10,7 +10,7 @@ use std::path::Path;
|
||||
|
||||
use whisper_rs::{FullParams, SamplingStrategy, WhisperContext, WhisperContextParameters};
|
||||
|
||||
use lumotia_core::error::{MagnotiaError, Result};
|
||||
use lumotia_core::error::{Error, Result};
|
||||
use lumotia_core::hardware::vulkan_loader_available;
|
||||
use lumotia_core::tuning::{inference_thread_count, Workload};
|
||||
use lumotia_core::types::{Segment, TranscriptionOptions};
|
||||
@@ -65,7 +65,7 @@ impl Transcriber for WhisperRsBackend {
|
||||
);
|
||||
|
||||
let mut state = self.ctx.create_state().map_err(|e| {
|
||||
MagnotiaError::TranscriptionFailed(
|
||||
Error::TranscriptionFailed(
|
||||
WhisperBackendError::State(e.to_string()).to_string(),
|
||||
)
|
||||
})?;
|
||||
@@ -88,7 +88,7 @@ impl Transcriber for WhisperRsBackend {
|
||||
params.set_print_realtime(false);
|
||||
|
||||
state.full(params, samples).map_err(|e| {
|
||||
MagnotiaError::TranscriptionFailed(
|
||||
Error::TranscriptionFailed(
|
||||
WhisperBackendError::Transcribe(e.to_string()).to_string(),
|
||||
)
|
||||
})?;
|
||||
@@ -103,7 +103,7 @@ impl Transcriber for WhisperRsBackend {
|
||||
let text = seg
|
||||
.to_str()
|
||||
.map_err(|e| {
|
||||
MagnotiaError::TranscriptionFailed(
|
||||
Error::TranscriptionFailed(
|
||||
WhisperBackendError::Transcribe(e.to_string()).to_string(),
|
||||
)
|
||||
})?
|
||||
|
||||
Reference in New Issue
Block a user