chore: stabilize current head before Phase 10a QC

This commit is contained in:
2026-05-10 23:00:25 +01:00
parent c95a5da077
commit b463c32f17
24 changed files with 238 additions and 89 deletions

View File

@@ -182,7 +182,9 @@ pub async fn update_transcript(
.bind(id)
.execute(pool)
.await
.map_err(|e| MagnotiaError::StorageError(format!("Update transcript failed: {e}")))?;
.map_err(|e| {
MagnotiaError::StorageError(format!("Update transcript failed: {e}"))
})?;
Ok(res.rows_affected())
}
(Some(t), None) => {
@@ -191,7 +193,9 @@ pub async fn update_transcript(
.bind(id)
.execute(pool)
.await
.map_err(|e| MagnotiaError::StorageError(format!("Update transcript failed: {e}")))?;
.map_err(|e| {
MagnotiaError::StorageError(format!("Update transcript failed: {e}"))
})?;
Ok(res.rows_affected())
}
(None, Some(ttl)) => {
@@ -200,7 +204,9 @@ pub async fn update_transcript(
.bind(id)
.execute(pool)
.await
.map_err(|e| MagnotiaError::StorageError(format!("Update transcript failed: {e}")))?;
.map_err(|e| {
MagnotiaError::StorageError(format!("Update transcript failed: {e}"))
})?;
Ok(res.rows_affected())
}
(None, None) => Ok(0),
@@ -484,7 +490,9 @@ pub async fn complete_subtask_and_check_parent(pool: &SqlitePool, subtask_id: &s
.bind(&pid)
.execute(&mut *tx)
.await
.map_err(|e| MagnotiaError::StorageError(format!("Auto-complete parent failed: {e}")))?;
.map_err(|e| {
MagnotiaError::StorageError(format!("Auto-complete parent failed: {e}"))
})?;
}
}
@@ -708,7 +716,9 @@ pub async fn set_implementation_rule_enabled(
.bind(id)
.execute(pool)
.await
.map_err(|e| MagnotiaError::StorageError(format!("Set implementation rule enabled failed: {e}")))?;
.map_err(|e| {
MagnotiaError::StorageError(format!("Set implementation rule enabled failed: {e}"))
})?;
get_implementation_rule(pool, id).await?.ok_or_else(|| {
MagnotiaError::StorageError(format!(
@@ -731,7 +741,9 @@ pub async fn mark_implementation_rule_fired(
.bind(id)
.execute(pool)
.await
.map_err(|e| MagnotiaError::StorageError(format!("Mark implementation rule fired failed: {e}")))?;
.map_err(|e| {
MagnotiaError::StorageError(format!("Mark implementation rule fired failed: {e}"))
})?;
get_implementation_rule(pool, id).await?.ok_or_else(|| {
MagnotiaError::StorageError(format!(
@@ -745,7 +757,9 @@ pub async fn delete_implementation_rule(pool: &SqlitePool, id: &str) -> Result<(
.bind(id)
.execute(pool)
.await
.map_err(|e| MagnotiaError::StorageError(format!("Delete implementation rule failed: {e}")))?;
.map_err(|e| {
MagnotiaError::StorageError(format!("Delete implementation rule failed: {e}"))
})?;
Ok(())
}
@@ -2511,24 +2525,21 @@ mod tests {
let removed = prune_error_log(&pool, 90).await.unwrap();
assert_eq!(removed, 1, "only the 200-day row should be pruned");
let remaining: Vec<String> = sqlx::query_scalar(
"SELECT context FROM error_log ORDER BY id ASC",
)
.fetch_all(&pool)
.await
.unwrap();
let remaining: Vec<String> =
sqlx::query_scalar("SELECT context FROM error_log ORDER BY id ASC")
.fetch_all(&pool)
.await
.unwrap();
assert_eq!(remaining, vec!["recent".to_string(), "older".to_string()]);
// A 14-day window prunes the 30-day row too.
let removed = prune_error_log(&pool, 14).await.unwrap();
assert_eq!(removed, 1);
let remaining: Vec<String> = sqlx::query_scalar(
"SELECT context FROM error_log",
)
.fetch_all(&pool)
.await
.unwrap();
let remaining: Vec<String> = sqlx::query_scalar("SELECT context FROM error_log")
.fetch_all(&pool)
.await
.unwrap();
assert_eq!(remaining, vec!["recent".to_string()]);
}
}