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

@@ -45,6 +45,7 @@ pub struct MemorySearchOptions {
///
/// Now a no-op for storage (VikingStorage initializes itself in viking_commands).
/// Only initializes PersistentMemoryStore for backward-compatible embedding config.
// @connected
#[tauri::command]
pub async fn memory_init(
app_handle: AppHandle,
@@ -60,6 +61,7 @@ pub async fn memory_init(
/// Store a new memory
///
/// Writes to VikingStorage (SqliteStorage) with FTS5 + TF-IDF indexing.
// @connected
#[tauri::command]
pub async fn memory_store(
entry: MemoryEntryInput,
@@ -125,6 +127,7 @@ fn to_persistent(entry: &zclaw_growth::MemoryEntry) -> PersistentMemory {
}
/// Get a memory by ID (URI)
// @connected
#[tauri::command]
pub async fn memory_get(
id: String,
@@ -141,6 +144,7 @@ pub async fn memory_get(
/// Search memories
///
/// Uses VikingStorage::find() for FTS5 + TF-IDF + optional embedding search.
// @connected
#[tauri::command]
pub async fn memory_search(
options: MemorySearchOptions,
@@ -182,6 +186,7 @@ pub async fn memory_search(
/// Delete a memory by ID (URI)
///
/// Deletes from VikingStorage only (PersistentMemoryStore is no longer primary).
// @connected
#[tauri::command]
pub async fn memory_delete(
id: String,
@@ -195,6 +200,7 @@ pub async fn memory_delete(
}
/// Delete all memories for an agent
// @connected
#[tauri::command]
pub async fn memory_delete_all(
agent_id: String,
@@ -222,6 +228,7 @@ pub async fn memory_delete_all(
}
/// Get memory statistics
// @connected
#[tauri::command]
pub async fn memory_stats(
_state: State<'_, MemoryStoreState>,
@@ -278,6 +285,7 @@ pub async fn memory_stats(
}
/// Export all memories for backup
// @connected
#[tauri::command]
pub async fn memory_export(
_state: State<'_, MemoryStoreState>,
@@ -299,6 +307,7 @@ pub async fn memory_export(
/// Import memories from backup
///
/// Converts PersistentMemory entries to VikingStorage MemoryEntry and stores them.
// @connected
#[tauri::command]
pub async fn memory_import(
memories: Vec<PersistentMemory>,
@@ -343,6 +352,7 @@ pub async fn memory_import(
/// Get the database path
///
/// Now returns the VikingStorage (SqliteStorage) path.
// @connected
#[tauri::command]
pub async fn memory_db_path(
_state: State<'_, MemoryStoreState>,
@@ -354,6 +364,7 @@ pub async fn memory_db_path(
/// Configure embedding for PersistentMemoryStore (chat memory search)
/// This is called alongside viking_configure_embedding to enable vector search in chat flow
// @reserved: 暂无前端集成
#[tauri::command]
pub async fn memory_configure_embedding(
provider: String,
@@ -388,6 +399,7 @@ pub async fn memory_configure_embedding(
}
/// Check if embedding is configured for PersistentMemoryStore
// @reserved: 暂无前端集成
#[tauri::command]
pub fn memory_is_embedding_configured() -> bool {
is_embedding_configured()
@@ -396,6 +408,7 @@ pub fn memory_is_embedding_configured() -> bool {
/// Build layered memory context for chat prompt injection
///
/// Uses VikingStorage (SqliteStorage) with FTS5 + TF-IDF + optional Embedding.
// @connected
#[tauri::command]
pub async fn memory_build_context(
agent_id: String,