From 5ccce3ea43aee9b22cfdd84eb1a4dd8885481940 Mon Sep 17 00:00:00 2001 From: sanil-23 Date: Wed, 27 May 2026 12:32:46 +0530 Subject: [PATCH] fix(test): make memory ingestion-status test residue-robust (queue_depth delta) (#2721) --- src/openhuman/memory/ops/sync.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/openhuman/memory/ops/sync.rs b/src/openhuman/memory/ops/sync.rs index 916cbbfe4..16db77fa1 100644 --- a/src/openhuman/memory/ops/sync.rs +++ b/src/openhuman/memory/ops/sync.rs @@ -367,6 +367,12 @@ mod tests { let client = ensure_memory_client(); let state = client.ingestion_state(); + // `queue_depth` is an AtomicUsize on the process-global ingestion state, + // which is shared (and not reset) across every memory::ops test. A prior + // test's in-flight ingestion can leave residue, so assert the delta from a + // captured baseline rather than an absolute depth — the snapshot fields set + // by mark_running below are overwritten per-call and remain deterministic. + let baseline_depth = state.snapshot().queue_depth; state.enqueue(); state.mark_running("doc-sync", "Sync Title", "sync-test"); @@ -379,7 +385,7 @@ mod tests { assert_eq!(status.current_document_id.as_deref(), Some("doc-sync")); assert_eq!(status.current_title.as_deref(), Some("Sync Title")); assert_eq!(status.current_namespace.as_deref(), Some("sync-test")); - assert_eq!(status.queue_depth, 1); + assert_eq!(status.queue_depth, baseline_depth + 1); state.dequeue(); state.mark_completed("doc-sync", true, 12345);