From 7d1461fc7430525bdeca277ed7059d8aafb78cc3 Mon Sep 17 00:00:00 2001 From: Frank <97429702+tsubasakong@users.noreply.github.com> Date: Sun, 8 Mar 2026 14:16:46 -0700 Subject: [PATCH] fix: standardize libSQL timestamps as RFC 3339 UTC (#683) * fix: standardize libsql timestamps * style: fix formatting in libsql/mod.rs [skip-regression-check] Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Zaki Co-authored-by: Claude Opus 4.6 --- src/db/libsql/mod.rs | 49 +++++++++++++++- src/db/libsql_migrations.rs | 110 ++++++++++++++++++------------------ 2 files changed, 103 insertions(+), 56 deletions(-) diff --git a/src/db/libsql/mod.rs b/src/db/libsql/mod.rs index 6ff8ca6b..2845c757 100644 --- a/src/db/libsql/mod.rs +++ b/src/db/libsql/mod.rs @@ -169,10 +169,18 @@ pub(crate) fn parse_timestamp(s: &str) -> Result, String> { } // Naive with fractional seconds (legacy or SQLite datetime() output) if let Ok(ndt) = NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.f") { + tracing::warn!( + timestamp = %s, + "parsed naive timestamp without timezone; assuming UTC for backward compatibility" + ); return Ok(ndt.and_utc()); } // Naive without fractional seconds (legacy format) if let Ok(ndt) = NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") { + tracing::warn!( + timestamp = %s, + "parsed naive timestamp without timezone; assuming UTC for backward compatibility" + ); return Ok(ndt.and_utc()); } Err(format!("unparseable timestamp: {:?}", s)) @@ -402,8 +410,47 @@ pub(crate) fn row_to_routine_run_libsql(row: &libsql::Row) -> Result