agent: lumotia-rebrand — drop MagnotiaError prefix, now lumotia_core::Error
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

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:
2026-05-13 08:58:05 +01:00
parent ce6dc1e728
commit 42f4d07e48
14 changed files with 92 additions and 92 deletions

View File

@@ -1,7 +1,7 @@
use std::io::BufWriter;
use std::path::Path;
use lumotia_core::error::{MagnotiaError, Result};
use lumotia_core::error::{Error, Result};
use lumotia_core::types::AudioSamples;
/// Append-friendly WAV writer for long-running captures.
@@ -40,10 +40,10 @@ impl WavWriter {
bits_per_sample: 16,
sample_format: hound::SampleFormat::Int,
};
let file = std::fs::File::create(path).map_err(MagnotiaError::from)?;
let file = std::fs::File::create(path).map_err(Error::from)?;
let buffered = BufWriter::new(file);
let inner = hound::WavWriter::new(buffered, spec).map_err(|e| {
MagnotiaError::from(std::io::Error::other(format!("WAV create failed: {e}")))
Error::from(std::io::Error::other(format!("WAV create failed: {e}")))
})?;
Ok(Self {
inner,
@@ -61,7 +61,7 @@ impl WavWriter {
let clamped = sample.clamp(-1.0, 1.0);
let int_sample = (clamped * i16::MAX as f32) as i16;
self.inner.write_sample(int_sample).map_err(|e| {
MagnotiaError::from(std::io::Error::other(format!("WAV write failed: {e}")))
Error::from(std::io::Error::other(format!("WAV write failed: {e}")))
})?;
}
self.samples_since_flush += samples.len();
@@ -78,7 +78,7 @@ impl WavWriter {
/// boundaries (end-of-utterance, UI events) for tighter recovery.
pub fn flush(&mut self) -> Result<()> {
self.inner.flush().map_err(|e| {
MagnotiaError::from(std::io::Error::other(format!("WAV flush failed: {e}")))
Error::from(std::io::Error::other(format!("WAV flush failed: {e}")))
})?;
self.samples_since_flush = 0;
Ok(())
@@ -90,7 +90,7 @@ impl WavWriter {
/// that care about the unflushed tail should always finalise.
pub fn finalize(self) -> Result<()> {
self.inner.finalize().map_err(|e| {
MagnotiaError::from(std::io::Error::other(format!("WAV finalize failed: {e}")))
Error::from(std::io::Error::other(format!("WAV finalize failed: {e}")))
})?;
Ok(())
}
@@ -106,19 +106,19 @@ pub fn write_wav(path: &Path, audio: &AudioSamples) -> Result<()> {
};
let mut writer = hound::WavWriter::create(path, spec).map_err(|e| {
MagnotiaError::from(std::io::Error::other(format!("WAV create failed: {e}")))
Error::from(std::io::Error::other(format!("WAV create failed: {e}")))
})?;
for &sample in audio.samples() {
let clamped = sample.clamp(-1.0, 1.0);
let int_sample = (clamped * i16::MAX as f32) as i16;
writer.write_sample(int_sample).map_err(|e| {
MagnotiaError::from(std::io::Error::other(format!("WAV write failed: {e}")))
Error::from(std::io::Error::other(format!("WAV write failed: {e}")))
})?;
}
writer.finalize().map_err(|e| {
MagnotiaError::from(std::io::Error::other(format!("WAV finalize failed: {e}")))
Error::from(std::io::Error::other(format!("WAV finalize failed: {e}")))
})?;
Ok(())
@@ -126,14 +126,14 @@ pub fn write_wav(path: &Path, audio: &AudioSamples) -> Result<()> {
/// Read a WAV file to f32 PCM `AudioSamples`.
///
/// Any per-sample decode error is surfaced as `MagnotiaError::AudioDecodeFailed`
/// Any per-sample decode error is surfaced as `Error::AudioDecodeFailed`
/// rather than silently dropped. A previous implementation used
/// `filter_map(|s| s.ok())`, so a truncated or corrupt payload returned
/// a short, silently-partial `AudioSamples` — callers got `Ok` while
/// losing audio (flagged by the 2026-04-22 review).
pub fn read_wav(path: &Path) -> Result<AudioSamples> {
let reader = hound::WavReader::open(path)
.map_err(|e| MagnotiaError::AudioDecodeFailed(format!("WAV open failed: {e}")))?;
.map_err(|e| Error::AudioDecodeFailed(format!("WAV open failed: {e}")))?;
let spec = reader.spec();
let sample_rate = spec.sample_rate;
@@ -147,7 +147,7 @@ pub fn read_wav(path: &Path) -> Result<AudioSamples> {
sample
.map(|s| s as f32 / (1 << (bits_per_sample - 1)) as f32)
.map_err(|e| {
MagnotiaError::AudioDecodeFailed(format!("WAV sample decode failed: {e}"))
Error::AudioDecodeFailed(format!("WAV sample decode failed: {e}"))
})
})
.collect::<Result<Vec<f32>>>()?,
@@ -155,7 +155,7 @@ pub fn read_wav(path: &Path) -> Result<AudioSamples> {
.into_samples::<f32>()
.map(|sample| {
sample.map_err(|e| {
MagnotiaError::AudioDecodeFailed(format!("WAV sample decode failed: {e}"))
Error::AudioDecodeFailed(format!("WAV sample decode failed: {e}"))
})
})
.collect::<Result<Vec<f32>>>()?,