refactor: Implement unified search abstraction, MemoryState refactoring, error handling, and unit test expansion

This commit is contained in:
Riz Ashraf committed 2026-10-01 08:37:52 +01:00
1 parent a34554b7ff
commit 462f65f66d
21 files changed
+425 -535

No files matched your search

+8 -8
View File
@@ -280,23 +280,23 @@ mod tests {
"content": "Buy milk",
});
let res = add_handler.execute(args, state.clone()).await.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;
let res = add_handler.execute(args, state.clone()).await.map_err(|e| crate::error::AppError::Internal(e.to_string())).unwrap();
assert!(res.contains("Sticky note added"));
let read_handler = ReadStickyNotesHandler;
let res2 = read_handler
.execute(json!({}), state.clone())
.await.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;
.await.map_err(|e| crate::error::AppError::Internal(e.to_string())).unwrap();
assert!(res2.contains("Buy milk"));
let delete_handler = DeleteStickyNoteHandler;
let args2 = json!({"index": 1});
let res3 = delete_handler.execute(args2, state.clone()).await.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;
let res3 = delete_handler.execute(args2, state.clone()).await.map_err(|e| crate::error::AppError::Internal(e.to_string())).unwrap();
assert_eq!(res3, "Sticky note deleted.");
let res4 = read_handler
.execute(json!({}), state.clone())
.await.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;
.await.map_err(|e| crate::error::AppError::Internal(e.to_string())).unwrap();
assert!(!res4.contains("Buy milk"));
}
@@ -312,13 +312,13 @@ mod tests {
"namespace": "global"
});
let res = handoff_handler.execute(args, state.clone()).await.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;
let res = handoff_handler.execute(args, state.clone()).await.map_err(|e| crate::error::AppError::Internal(e.to_string())).unwrap();
assert_eq!(res, "Handoff memo left");
let read_handoff = ReadHandoffMemosHandler;
let res2 = read_handoff
.execute(json!({"namespace": "global"}), state.clone())
.await.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;
.await.map_err(|e| crate::error::AppError::Internal(e.to_string())).unwrap();
assert!(res2.contains("Finished implementing graph tests"));
let summary_handler = AddSessionSummaryHandler;
@@ -328,7 +328,7 @@ mod tests {
});
let res3 = summary_handler
.execute(args_sum, state.clone())
.await.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;
.await.map_err(|e| crate::error::AppError::Internal(e.to_string())).unwrap();
assert_eq!(res3, "Session summary added");
let standup_handler = GenerateStandupReportHandler;
@@ -337,7 +337,7 @@ mod tests {
json!({"namespace": "global", "hours_lookback": 24}),
state.clone(),
)
.await.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;
.await.map_err(|e| crate::error::AppError::Internal(e.to_string())).unwrap();
assert!(!res4.is_empty());
}
}