From e1020a60d48e0c59b325084e65fe1e95c5b7a186 Mon Sep 17 00:00:00 2001 From: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Date: Wed, 7 Oct 2026 09:17:50 -0400 Subject: [PATCH] test(archive): stamp expiry fixtures with one fixed time storage_partition_dedup_policy_paging_and_shrinking stamped each fixture event with the wall clock but pruned relative to the first event's time. prune(now + 86401) with a 1-day window removes only rows created at most 1 s after `now`. When the 205 ingests took over a second, as on a loaded runner, later rows survived and the "expired observer rows are gone" assertion at tests.rs:185 failed. All fixtures in the test now share the first event's timestamp, so the expiry boundary is exact regardless of runner speed. Production expiry code is unchanged. A 2.1 s delay inside the ingest loop reproduces the CI assertion on the old test and passes with this change. Signed-off-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> --- src-tauri/src/archive/tests.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src-tauri/src/archive/tests.rs b/src-tauri/src/archive/tests.rs index 926ad044d..7e985f68b 100644 --- a/src-tauri/src/archive/tests.rs +++ b/src-tauri/src/archive/tests.rs @@ -60,6 +60,9 @@ fn storage_partition_dedup_policy_paging_and_shrinking() { let viewer = viewer(); let event = envelope(&viewer, 24200, 0); let now = event.created_at as i64; + // One timestamp for every fixture. prune(now + 86401) expires only rows + // stamped at most 1 s after `now`; wall-clock stamps from a slow run survive. + let at = |kind, serial| envelope_at(&viewer, kind, serial, event.created_at); for community in ["https://a.test", "https://b.test"] { store.seed(&viewer, community).unwrap(); } @@ -87,19 +90,13 @@ fn storage_partition_dedup_policy_paging_and_shrinking() { .unwrap() .0 .is_empty()); - let metrics = envelope(&viewer, 44200, 1); + let metrics = at(44200, 1); store .ingest(&viewer, "https://a.test", &metrics, 0, now) .unwrap(); for i in 1..205 { store - .ingest( - &viewer, - "https://a.test", - &envelope(&viewer, 24200, i), - 0, - now, - ) + .ingest(&viewer, "https://a.test", &at(24200, i), 0, now) .unwrap(); } let page = store @@ -142,7 +139,7 @@ fn storage_partition_dedup_policy_paging_and_shrinking() { assert!(store .ingest(&viewer, "https://a.test", &event, 0, now) .is_err()); - let disabled = envelope(&viewer, 24200, 999); + let disabled = at(24200, 999); store .ingest(&viewer, "https://a.test", &disabled, 1, now) .unwrap();