style: cargo fmt --all (v0.20.x logging r2 feature follow-up)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 06:34:01 +00:00
parent 35c987df1c
commit 9a36a06f97
9 changed files with 48 additions and 60 deletions

View File

@@ -1018,11 +1018,19 @@ impl SqliteStore {
ms, chars, success, reason, ocr_engine)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
rusqlite::params![
run_id, ts, doc_id, doc_path, page,
image_byte_size, image_width, image_height,
ms, chars,
run_id,
ts,
doc_id,
doc_path,
page,
image_byte_size,
image_width,
image_height,
ms,
chars,
if success { 1i32 } else { 0i32 },
reason, ocr_engine
reason,
ocr_engine
],
)?;
Ok(())
@@ -1034,8 +1042,7 @@ impl SqliteStore {
/// means "delete everything older than now" (i.e. all past rows).
pub fn prune_pdf_ocr_events(&self, retention_days: u32) -> anyhow::Result<u64> {
use time::format_description::well_known::Rfc3339;
let cutoff = time::OffsetDateTime::now_utc()
- time::Duration::days(retention_days as i64);
let cutoff = time::OffsetDateTime::now_utc() - time::Duration::days(retention_days as i64);
let cutoff_ts = cutoff
.format(&Rfc3339)
.unwrap_or_else(|_| "1970-01-01T00:00:00Z".to_string());

View File

@@ -25,7 +25,11 @@ fn v008_pdf_ocr_events_table_exists() {
)
.optional()
});
assert_eq!(name.as_deref(), Some("pdf_ocr_events"), "pdf_ocr_events table must exist after V008");
assert_eq!(
name.as_deref(),
Some("pdf_ocr_events"),
"pdf_ocr_events table must exist after V008"
);
}
/// AC-8: insert 2 rows with different timestamps; prune with retention_days=0
@@ -74,9 +78,7 @@ fn record_and_prune_pdf_ocr_event() {
// prune with retention_days=0 → cutoff=now → deletes any row with ts < now.
// The 1970 row should be deleted; the 2099 row survives.
let pruned = store
.prune_pdf_ocr_events(0)
.expect("prune");
let pruned = store.prune_pdf_ocr_events(0).expect("prune");
assert_eq!(pruned, 1, "should have deleted exactly 1 old row");
// Verify only the future row remains