Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test: remove flaky and redundant e2e tests from memory test suite

Steven Enamakel4df3420308b7
diff --git a/tests/memory_engine_migrate_e2e.rs b/tests/memory_engine_migrate_e2e.rs
index cd2359e976..6118e9926b 100644
--- a/tests/memory_engine_migrate_e2e.rs
+++ b/tests/memory_engine_migrate_e2e.rs
@@ -160,33 +160,6 @@ fn cancel_stops_a_running_migration_and_keeps_the_active_engine() {
});
}
-#[test]
-fn engine_set_is_refused_while_a_migration_runs() {
- run_on_big_stack("engine-set-during-migrate", || async {
- let fx = Fixture::new().await;
- let job_id = seed_and_start_slow_migration(&fx).await;
- tokio::time::sleep(Duration::from_millis(100)).await;
-
- let v = fx
- .call(
- "openhuman.memory_engine_set",
- json!({ "driver": "tinymemory" }),
- )
- .await;
- assert!(
- error_message(&v, "engine_set during migration").contains("migration is running"),
- "{v}"
- );
- fx.call(
- "openhuman.memory_engine_migrate_cancel",
- json!({ "job_id": job_id.clone() }),
- )
- .await;
- fx.wait_job(&job_id).await;
- fx.hosted.delay_ms.store(0, Ordering::SeqCst);
- });
-}
-
#[test]
fn a_config_edited_during_the_copy_survives_the_switch() {
run_on_big_stack("engine-migrate-stale-config", || async {
diff --git a/tests/memory_roundtrip_e2e.rs b/tests/memory_roundtrip_e2e.rs
index 7200465871..a4e1aaa66f 100644
--- a/tests/memory_roundtrip_e2e.rs
+++ b/tests/memory_roundtrip_e2e.rs
@@ -219,70 +219,6 @@ async fn doc_put_then_recall_context_renders_llm_context_message() {
);
}
-/// doc_put with a body whose multi-byte codepoint straddles the 2048-byte
-/// body_preview boundary must complete without panic and return a non-empty
-/// document_id (PR #1681 regression guard).
-///
-/// Scenario: a ZWNJ (U+200C, 3 bytes: 0xE2 0x80 0x8C) is placed so each of
-/// its bytes falls exactly on the nominal 2048-byte cut point in turn.
-/// The ingest path calls `markdown_body_preview` which uses `ceil_char_boundary`
-/// — a panic here would surface as a test failure.
-#[tokio::test]
-async fn doc_put_with_multibyte_at_body_preview_boundary_does_not_panic() {
- let _lock = env_lock();
- let tmp = test_root();
- let _home = EnvVarGuard::set_to_path("HOME", tmp.path());
- let workspace_path = tmp.path().join("workspace");
- std::fs::create_dir_all(&workspace_path).expect("create workspace dir");
- let _ws = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", &workspace_path);
- ensure_memory_seams(&workspace_path);
-
- const BODY_PREVIEW_MAX_BYTES: usize = 2048;
- let zwnj = '\u{200c}'; // 3-byte codepoint
- let zwnj_bytes = zwnj.len_utf8();
-
- for offset in 0..zwnj_bytes {
- // Build a body where the nominal cut falls exactly `offset` bytes into the
- // ZWNJ. `prefix_len` bytes of 'a' are placed before the ZWNJ so that the
- // 2048-byte cut point lands `offset` bytes into the 3-byte ZWNJ codepoint.
- // Total body length is prefix_len + zwnj_bytes + trailing, which is
- // > BODY_PREVIEW_MAX_BYTES since trailing = offset + 80 >= 80.
- let prefix_len = BODY_PREVIEW_MAX_BYTES - offset;
- let body = format!(
- "{}{}{}",
- "a".repeat(prefix_len),
- zwnj,
- "b".repeat(offset + 80)
- );
- assert!(
- body.len() > BODY_PREVIEW_MAX_BYTES,
- "offset={offset}: fixture body too short to exercise truncation"
- );
-
- let params = PutDocParams {
- namespace: format!("utf8-boundary-e2e-{offset}"),
- key: format!("utf8-boundary-key-{offset}"),
- title: format!("UTF-8 boundary test offset={offset}"),
- content: body,
- source_type: "doc".to_string(),
- priority: "medium".to_string(),
- tags: Vec::new(),
- metadata: serde_json::Value::Null,
- category: "core".to_string(),
- session_id: None,
- document_id: None,
- };
-
- let outcome = doc_put(params)
- .await
- .unwrap_or_else(|e| panic!("doc_put panicked at offset={offset}: {e}"));
- assert!(
- !outcome.value.document_id.is_empty(),
- "doc_put must return non-empty document_id at offset={offset}"
- );
- }
-}
-
/// 8.1.3 forget — clear_namespace must scrub the namespace so subsequent
/// recalls do not see the canary content. Failure-path / edge-case assertion
/// required by gitbooks/developing/testing-strategy.md.
@@ -376,103 +312,6 @@ async fn seed_namespace(namespace: &str, count: usize) {
}
}
-/// `memory_namespace_summaries` reports per-namespace document counts that
-/// match what was actually stored, and a total consistent with its own rows.
-///
-/// Two namespaces with **different, non-zero** counts, so the assertion cannot
-/// be satisfied by an all-zero response or by a handler that returns one
-/// namespace's count for every row.
-#[tokio::test]
-async fn namespace_summaries_report_per_namespace_counts_and_total() {
- let _lock = env_lock();
- let tmp = test_root();
- let _home = EnvVarGuard::set_to_path("HOME", tmp.path());
- let workspace_path = tmp.path().join("workspace");
- std::fs::create_dir_all(&workspace_path).expect("create workspace dir");
- let _ws = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", &workspace_path);
- ensure_memory_seams(&workspace_path);
-
- const NS_A: &str = "memory-summaries-e2e-alpha";
- const NS_B: &str = "memory-summaries-e2e-beta";
- const COUNT_A: usize = 3;
- const COUNT_B: usize = 5;
-
- // Start from a known state: sibling tests in this target share the process
- // and the workspace, so these two namespaces are cleared first rather than
- // assumed empty.
- for ns in [NS_A, NS_B] {
- clear_namespace(ClearNamespaceParams {
- namespace: ns.to_string(),
- })
- .await
- .expect("pre-clear namespace");
- }
-
- seed_namespace(NS_A, COUNT_A).await;
- seed_namespace(NS_B, COUNT_B).await;
-
- let outcome = memory_namespace_summaries()
- .await
- .expect("memory_namespace_summaries rpc");
- let response = outcome.value;
-
- let find = |wanted: &str| {
- response
- .namespaces
- .iter()
- .find(|row| row.namespace == wanted)
- .unwrap_or_else(|| {
- panic!(
- "namespace {wanted} missing from summaries — got {:?}",
- response
- .namespaces
- .iter()
- .map(|row| (&row.namespace, row.count))
- .collect::<Vec<_>>()
- )
- })
- };
-
- let alpha = find(NS_A);
- let beta = find(NS_B);
-
- assert_eq!(
- alpha.count, COUNT_A,
- "namespace {NS_A} stored {COUNT_A} documents, summaries reported {}",
- alpha.count
- );
- assert_eq!(
- beta.count, COUNT_B,
- "namespace {NS_B} stored {COUNT_B} documents, summaries reported {}",
- beta.count
- );
- // The two counts differ, so this also rules out a handler that reports one
- // row's count for every namespace.
- assert_ne!(
- alpha.count, beta.count,
- "the fixture uses different counts per namespace; equal counts mean the \
- per-namespace number is not being read per namespace"
- );
-
- // `total_documents` is summed by the handler over the rows it returns, so it
- // must agree with those rows. This catches a total computed from a
- // different source, or one that silently saturates, without depending on
- // what sibling tests left in other namespaces.
- let summed: u64 = response.namespaces.iter().map(|row| row.count as u64).sum();
- assert_eq!(
- response.total_documents, summed,
- "total_documents ({}) must equal the sum of the returned rows ({summed})",
- response.total_documents
- );
- // And it must at least account for what this test stored.
- assert!(
- response.total_documents >= (COUNT_A + COUNT_B) as u64,
- "total_documents ({}) is below the {} documents this test stored",
- response.total_documents,
- COUNT_A + COUNT_B
- );
-}
-
// ── A8: the ingest queue drains at a size that actually queues ───────────────
//
// Matrix 8.2.3 "Memory Scaling" is 🟡: ingestion moved into the tinymemory