From 7146ee550944c71a4e48018a34820ce9a9d99f95 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 11 Dec 2025 13:09:39 +0000 Subject: fix: classify sync events as startup/live based on EOSE, not relay type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, events were classified as 'startup' or 'live' based on whether they came from a bootstrap relay (is_bootstrap flag). This meant ALL events from bootstrap relays were counted as 'startup', even events received after the initial sync completed. Now events are classified based on whether EOSE (End Of Stored Events) has been received for that connection: - Events BEFORE EOSE → 'startup' (historical events during initial sync) - Events AFTER EOSE → 'live' (new events via real-time subscription) This enables the test_live_sync_event_count test which validates that events received after sync connection is established are counted as live events. Also removed the #[ignore] attribute from test_live_sync_event_count since the metrics are now properly wired up. --- tests/sync/metrics.rs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'tests') diff --git a/tests/sync/metrics.rs b/tests/sync/metrics.rs index 3accd0f..98ce4f3 100644 --- a/tests/sync/metrics.rs +++ b/tests/sync/metrics.rs @@ -410,11 +410,7 @@ async fn test_connection_failure_increments_counter() { /// This test validates that events received via live subscription /// (after sync connection is established) are counted separately /// from startup/bootstrap events. -/// -/// NOTE: This test may fail until sync metrics recording is fully wired up. -/// The test documents the expected behavior. #[tokio::test] -#[ignore] // Enable when live event sync metrics are wired up async fn test_live_sync_event_count() { let mut harness = MetricsTestHarness::with_sources(1).await; @@ -437,8 +433,6 @@ async fn test_live_sync_event_count() { let live_count = metrics.events_total("live"); println!("Live events synced: {:?}", live_count); - // NOTE: This will likely fail until sync metrics are wired up - // Test documents the expectation assert_eq!(live_count, Some(2), "Should have 2 live events"); harness.stop_all().await; -- cgit v1.2.3