Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

test(mcp): make sustained progress assertion portable (#283)

AkitaOnRailsd3cfd369504b
diff --git a/crates/ai-memory-mcp/tests/autoscope_stress.rs b/crates/ai-memory-mcp/tests/autoscope_stress.rs
index 406d3038..850523e8 100644
--- a/crates/ai-memory-mcp/tests/autoscope_stress.rs
+++ b/crates/ai-memory-mcp/tests/autoscope_stress.rs
@@ -979,10 +979,12 @@ async fn sustained_per_session_isolation_holds_under_continuous_traffic() {
}
let mut total_ops = 0_u64;
+ let mut ops_by_session = Vec::with_capacity(SESSIONS);
let mut leaks = Vec::new();
- for d in drivers {
+ for (index, d) in drivers.into_iter().enumerate() {
let (ops, leak) = d.await.expect("driver join");
total_ops += ops;
+ ops_by_session.push((index + 1, ops));
if let Some(msg) = leak {
leaks.push(msg);
}
@@ -995,19 +997,23 @@ async fn sustained_per_session_isolation_holds_under_continuous_traffic() {
leaks.join("\n---\n")
);
- // Lower bound on completed ops — a generous floor that would only
- // fail if the engine seized up entirely under load. The real signal
- // is the leak assertion; this is just a "did we actually exercise
- // anything" check so a future regression making each op take 5s
- // doesn't pass a no-op test.
- let min_ops = (SESSIONS as u64) * 50;
+ // This is a concurrency correctness test, not a shared-runner benchmark.
+ // Require repeated progress from every driver instead of an aggregate
+ // throughput floor: one fast session cannot hide another that starved,
+ // while slow Windows filesystem runners are not mistaken for data leaks.
+ const MIN_OPS_PER_SESSION: u64 = 5;
+ let stalled = ops_by_session
+ .iter()
+ .filter(|(_, ops)| *ops < MIN_OPS_PER_SESSION)
+ .map(|(session, ops)| format!("sustained-sess-{session}={ops}"))
+ .collect::<Vec<_>>();
assert!(
- total_ops >= min_ops,
- "sustained-rate stress completed only {total_ops} ops across {SESSIONS} \
- sessions in {duration_secs}s (expected >= {min_ops}). \
- Either the harness is broken or perf regressed catastrophically."
+ stalled.is_empty(),
+ "sustained-rate stress did not make repeated progress in every session \
+ over {duration_secs}s (expected >= {MIN_OPS_PER_SESSION} each): {}",
+ stalled.join(", ")
);
- println!("sustained stress: {total_ops} ops in {duration_secs}s ({SESSIONS} sessions)");
+ println!("sustained stress: {total_ops} ops in {duration_secs}s: {ops_by_session:?}");
}
// ────────────────────────────────────────────────────────────────────────────