feat: add tag_dao to InsightGenerator for tag-based context enrichment

Threads SqliteTagDao through InsightGenerator and AppState (both default
and test_state). Adds Send+Sync bounds to TagDao trait with unsafe impls
for SqliteTagDao (always Mutex-protected) and TestTagDao (single-threaded).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cameron
2026-03-18 16:59:39 -04:00
parent b31b4b903c
commit 387ce23afd
3 changed files with 20 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ use crate::database::models::InsertPhotoInsight;
use crate::database::{
CalendarEventDao, DailySummaryDao, ExifDao, InsightDao, LocationHistoryDao, SearchHistoryDao,
};
use crate::tags::TagDao;
use crate::memories::extract_date_from_filename;
use crate::otel::global_tracer;
use crate::utils::normalize_path;
@@ -45,6 +46,7 @@ pub struct InsightGenerator {
calendar_dao: Arc<Mutex<Box<dyn CalendarEventDao>>>,
location_dao: Arc<Mutex<Box<dyn LocationHistoryDao>>>,
search_dao: Arc<Mutex<Box<dyn SearchHistoryDao>>>,
tag_dao: Arc<Mutex<Box<dyn TagDao>>>,
base_path: String,
}
@@ -59,6 +61,7 @@ impl InsightGenerator {
calendar_dao: Arc<Mutex<Box<dyn CalendarEventDao>>>,
location_dao: Arc<Mutex<Box<dyn LocationHistoryDao>>>,
search_dao: Arc<Mutex<Box<dyn SearchHistoryDao>>>,
tag_dao: Arc<Mutex<Box<dyn TagDao>>>,
base_path: String,
) -> Self {
Self {
@@ -70,6 +73,7 @@ impl InsightGenerator {
calendar_dao,
location_dao,
search_dao,
tag_dao,
base_path,
}
}