fix(tauri): replace silent let _ = with structured logging across 20 modules

Replace error-swallowing let _ = patterns with tracing::warn! in browser,
classroom, gateway, intelligence, memory, pipeline, secure_storage, and
viking command handlers. Ensures errors are observable in production logs.
This commit is contained in:
iven
2026-04-03 00:28:39 +08:00
parent 52bdafa633
commit 15d578c5bc
20 changed files with 129 additions and 0 deletions

View File

@@ -131,6 +131,7 @@ fn get_data_dir_string() -> Option<String> {
// === Tauri Commands ===
/// Check if memory storage is available
// @connected
#[tauri::command]
pub async fn viking_status() -> Result<VikingStatus, String> {
match get_storage().await {
@@ -158,6 +159,7 @@ pub async fn viking_status() -> Result<VikingStatus, String> {
}
/// Add a memory entry
// @connected
#[tauri::command]
pub async fn viking_add(uri: String, content: String) -> Result<VikingAddResult, String> {
let storage = get_storage().await?;
@@ -180,6 +182,7 @@ pub async fn viking_add(uri: String, content: String) -> Result<VikingAddResult,
}
/// Add a memory with metadata
// @reserved: 暂无前端集成
#[tauri::command]
pub async fn viking_add_with_metadata(
uri: String,
@@ -210,6 +213,7 @@ pub async fn viking_add_with_metadata(
}
/// Find memories by semantic search
// @connected
#[tauri::command]
pub async fn viking_find(
query: String,
@@ -255,6 +259,7 @@ pub async fn viking_find(
}
/// Grep memories by pattern (uses FTS5)
// @connected
#[tauri::command]
pub async fn viking_grep(
pattern: String,
@@ -308,6 +313,7 @@ pub async fn viking_grep(
}
/// List memories at a path
// @connected
#[tauri::command]
pub async fn viking_ls(path: String) -> Result<Vec<VikingResource>, String> {
let storage = get_storage().await?;
@@ -335,6 +341,7 @@ pub async fn viking_ls(path: String) -> Result<Vec<VikingResource>, String> {
}
/// Read memory content
// @connected
#[tauri::command]
pub async fn viking_read(uri: String, level: Option<String>) -> Result<String, String> {
let storage = get_storage().await?;
@@ -378,6 +385,7 @@ pub async fn viking_read(uri: String, level: Option<String>) -> Result<String, S
}
/// Remove a memory
// @connected
#[tauri::command]
pub async fn viking_remove(uri: String) -> Result<(), String> {
let storage = get_storage().await?;
@@ -391,6 +399,7 @@ pub async fn viking_remove(uri: String) -> Result<(), String> {
}
/// Get memory tree
// @connected
#[tauri::command]
pub async fn viking_tree(path: String, depth: Option<usize>) -> Result<serde_json::Value, String> {
let max_depth = depth.unwrap_or(5);
@@ -441,6 +450,7 @@ pub async fn viking_tree(path: String, depth: Option<usize>) -> Result<serde_jso
}
/// Inject memories into prompt (for agent loop integration)
// @connected
#[tauri::command]
pub async fn viking_inject_prompt(
agent_id: String,
@@ -533,6 +543,7 @@ fn parse_uri(uri: &str) -> Result<(String, MemoryType, String), String> {
/// Configure embedding for semantic memory search
/// Configures both SqliteStorage (VikingPanel) and PersistentMemoryStore (chat flow)
// @connected
#[tauri::command]
pub async fn viking_configure_embedding(
provider: String,
@@ -590,6 +601,7 @@ pub async fn viking_configure_embedding(
}
/// Configure summary driver for L0/L1 auto-generation
// @connected
#[tauri::command]
pub async fn viking_configure_summary_driver(
endpoint: String,
@@ -604,6 +616,7 @@ pub async fn viking_configure_summary_driver(
}
/// Store a memory and optionally generate L0/L1 summaries in the background
// @reserved: 暂无前端集成
#[tauri::command]
pub async fn viking_store_with_summaries(
uri: String,