Fix agentic reel audit issues: midnight bug, DAO wiring, dead code, DST timezone, validation
Blocking fixes: - secs_until_next_run_hour: same-hour now returns 0 instead of 24h - capture_prefs: called at both handler return points, never fails request - capture_prefs: resolves library param, upserts to user_ai_prefs via DAO - Scheduler: uses AppState DAOs instead of separate connections - Pregen dedup: uses resolved library param instead of hardcoded 'all' - run_readonly_tool_loop: added #[allow(dead_code)] (used in main.rs only) - run_readonly_tool_loop: removed dead messages.push() call - InsightGenerator: added exif_dao() getter for scheduler reuse Medium fixes: - Input validation: run_hour clamped 0-23, week_dow clamped 0-6 - DST-sensitive timezone: fixed_tz_offset() with env var config Low fixes: - Documented REEL_PREGEN_MAX_TOOL_ITERS and REEL_PREGEN_TZ_FIXED_MINUTES - Removed dead test_app_state function and unused imports Also fix: UpsertUserAiPrefs import path, chrono::Local::with_ymd_and_hms requires TimeZone trait + .single(), unwrap_or_else closure simplification
This commit is contained in:
1 parent
f707353807
commit
5c9ee56527
4 files changed
+151
-180
No files matched your search
+1
-17
@@ -268,23 +268,7 @@ fn main() -> std::io::Result<()> {
|
||||
}
|
||||
|
||||
// Spawn the nightly pre-generation scheduler (Section D).
|
||||
{
|
||||
use crate::database::{
|
||||
InsightDao, SqliteInsightDao, SqliteUserAiPrefsDao, UserAiPrefsDao,
|
||||
};
|
||||
|
||||
let insight_dao: Arc<Mutex<Box<dyn InsightDao>>> =
|
||||
Arc::new(Mutex::new(Box::new(SqliteInsightDao::new())));
|
||||
let prefs_dao: Arc<Mutex<Box<dyn UserAiPrefsDao>>> =
|
||||
Arc::new(Mutex::new(Box::new(SqliteUserAiPrefsDao::new())));
|
||||
|
||||
reels::spawn_pregen_scheduler(
|
||||
app_state.clone(),
|
||||
web::Data::new(insight_dao),
|
||||
web::Data::new(prefs_dao),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
reels::spawn_pregen_scheduler(app_state.clone()).await;
|
||||
|
||||
HttpServer::new(move || {
|
||||
let user_dao = SqliteUserDao::new();
|
||||
|
||||
Reference in new issue
Block a user