Skip to content

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

fix(composio): correct test module structure for direct mode and integration tests

Steven Enamakel8330888db7dc
diff --git a/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs
index 7ea5bd71f7..f18fe7e5c6 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs
@@ -451,14 +451,11 @@ fn composio_direct_500_does_not_demote() {
#[tokio::test]
async fn enrich_does_nothing_when_no_cached_identities() {
- // `enrich_connections_with_identity` reads through the bound memory
- // driver now (`identity_store::load_connected_identities`), not the
- // deleted engine's process-global client — see the module doc comment on
- // `identity_store`. The fresh temp workspace has no profiles, so it
- // returns `Vec::new()` and the connection is returned unchanged.
+ // `enrich_connections_with_identity` reads the workspace identities file
+ // (`identity_store::load_connected_identities`). The fresh temp workspace
+ // has none, so the connection is returned unchanged.
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);
- crate::memory::test_support::install_memory_driver_for_test(&config);
let resp = make_connections_response(&[("c1", "gmail", "ACTIVE")]);
let enriched = enrich_connections_with_identity(&config, resp).await;
assert_eq!(enriched.connections.len(), 1);
@@ -473,7 +470,6 @@ async fn enrich_skips_connection_already_having_identity() {
// enricher must NOT overwrite it with a potentially stale cached value.
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);
- crate::memory::test_support::install_memory_driver_for_test(&config);
let mut resp = make_connections_response(&[("c-preloaded", "gmail", "ACTIVE")]);
resp.connections[0].account_email = Some("[email protected]".to_string());
@@ -495,7 +491,6 @@ async fn enrich_leaves_unmatched_connection_unchanged() {
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);
- crate::memory::test_support::install_memory_driver_for_test(&config);
// Persist a profile for a DIFFERENT connection id.
persist_provider_profile(
@@ -519,65 +514,14 @@ async fn enrich_leaves_unmatched_connection_unchanged() {
);
}
-/// A run that wrote nothing because the day's request budget was spent must
-/// say so: the UI shows "Up to date" for a zero count, and a spent budget is
-/// the opposite. The note rides after the count so the parse contract holds,
-/// and a blank note is no separator with nothing behind it.
-#[test]
-fn completed_detail_carries_the_module_note_after_the_count() {
- let re = regex::Regex::new(r"(?i)ingested\s+(\d+)\s+item").expect("ui parse regex");
- let detail = crate::integrations::composio::ops::completed_sync_detail(
- 0,
- true,
- Some("today's provider request budget is spent"),
- );
- let caps = re.captures(&detail).expect("detail still parses");
- assert_eq!(&caps[1], "0");
- assert!(
- detail.ends_with("; today's provider request budget is spent"),
- "{detail}"
- );
- let bare = crate::integrations::composio::ops::completed_sync_detail(3, false, Some(" "));
- assert_eq!(bare, "ingested 3 item(s)");
-}
-
-/// The per-source depth cap is matched the way the engine keys the rows and a
-/// zero reads as "no cap": the settings field stores unlimited as empty, and a
-/// zero typed by hand must not ask for mail newer than today.
-#[test]
-fn source_depth_matches_the_row_and_treats_zero_as_unbounded() {
- use crate::integrations::composio::ops::pick_source_sync_depth_days;
- let rows = [
- (Some("gmail"), Some("conn-1"), Some(30)),
- (Some("gmail"), Some("conn-2"), Some(0)),
- (Some("notion"), Some("conn-3"), Some(14)),
- (Some("gmail"), None, Some(7)),
- ];
- assert_eq!(
- pick_source_sync_depth_days(rows, "gmail", "conn-1"),
- Some(30)
- );
- assert_eq!(
- pick_source_sync_depth_days(rows, " GMAIL ", "conn-1 "),
- Some(30)
- );
- assert_eq!(pick_source_sync_depth_days(rows, "gmail", "conn-2"), None);
- assert_eq!(pick_source_sync_depth_days(rows, "gmail", "conn-9"), None);
- assert_eq!(
- pick_source_sync_depth_days(rows, "notion", "conn-3"),
- Some(14)
- );
- assert_eq!(pick_source_sync_depth_days([], "gmail", "conn-1"), None);
-}
-
// ── Backend mode with no session yet (#6176) ──────────────────────────
//
// The twin of the direct-mode-without-key guard: backend mode (the default)
// with no app-session JWT is the fresh-install / signed-out state.
// `composio_list_connections` must answer with an empty list instead of
// letting the connector module report "loaded without a connector route",
-// which the boot-time memory-source reconcile and the 60 s periodic tick
-// would otherwise turn into an error-level report and a Sentry event.
+// which callers would otherwise turn into an error-level report and a Sentry
+// event.
/// Store an app-session JWT in the auth store `config` points at, the same
/// way `client_tests::config_with_session_token` does.
diff --git a/crates/openhuman-core/src/integrations/composio/ops_fetch_integrations_and_triggers_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_fetch_integrations_and_triggers_tests.rs
index b0825253a9..9f15d598fc 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_fetch_integrations_and_triggers_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_fetch_integrations_and_triggers_tests.rs
@@ -646,27 +646,7 @@ async fn composio_list_connections_returns_empty_when_direct_mode_no_key() {
);
}
-// ── sync stage-event contracts (#5932) ───────────────────────────────────────
-
-/// The completed-stage detail is a parse contract with the Sources UI, which
-/// extracts the count via `/ingested\s+(\d+)\s+item/i` and shows a generic
-/// "up to date" when the pattern misses (#3295). This is the exact regex,
-/// ported, against the exact producer.
-#[test]
-fn completed_sync_detail_matches_the_ui_parse_contract() {
- let re = regex::Regex::new(r"(?i)ingested\s+(\d+)\s+item").expect("ui parse regex");
- for count in [0u64, 1, 200, 25_000] {
- let detail = crate::integrations::composio::ops::completed_sync_detail(count, false, None);
- let caps = re
- .captures(&detail)
- .unwrap_or_else(|| panic!("detail must parse: {detail}"));
- assert_eq!(
- caps[1].parse::<u64>().unwrap(),
- count,
- "count survives: {detail}"
- );
- }
-}
+// ── sync reasons ─────────────────────────────────────────────────────────────
/// Every parsed sync reason is a distinct event trigger — the stage events
/// must not collapse periodic and connection-created syncs into "manual"
@@ -688,38 +668,3 @@ fn sync_reasons_map_to_distinct_triggers() {
}
assert_eq!(seen.len(), 3);
}
-
-/// The budgeted loop's arithmetic, held still: unlimited slices at the pass
-/// ceiling, a cap slices to min(remaining, ceiling), a spent cap ends the run
-/// (review finding on #5932 — this is the PR's core behavioural change).
-#[test]
-fn next_pass_budget_slices_and_exhausts_the_configured_cap() {
- use crate::integrations::composio::ops::{next_pass_budget, SYNC_PASS_MAX_ITEMS};
- // Unlimited: every pass gets the ceiling.
- assert_eq!(next_pass_budget(None, 0), Some(SYNC_PASS_MAX_ITEMS));
- assert_eq!(next_pass_budget(None, 1_000_000), Some(SYNC_PASS_MAX_ITEMS));
- // A cap below the ceiling (200 since openhuman#6025) is one exact slice,
- // then exhaustion.
- assert_eq!(next_pass_budget(Some(50), 0), Some(50));
- assert_eq!(next_pass_budget(Some(50), 50), None);
- // A cap above the ceiling slices pass by pass and ends on the remainder —
- // a remainder smaller than the ceiling, so the two cannot be confused.
- assert_eq!(next_pass_budget(Some(1_100), 0), Some(SYNC_PASS_MAX_ITEMS));
- assert_eq!(next_pass_budget(Some(1_100), 1_000), Some(100));
- assert_eq!(next_pass_budget(Some(1_100), 1_100), None);
- // Over-written past the cap (dedupe drift) still ends, never underflows.
- assert_eq!(next_pass_budget(Some(100), 150), None);
-}
-
-/// Both detail variants keep the UI parse contract; the remainder text rides
-/// after the count, never inside it.
-#[test]
-fn completed_detail_keeps_the_contract_with_a_remainder() {
- let re = regex::Regex::new(r"(?i)ingested\s+(\d+)\s+item").expect("ui parse regex");
- let capped = crate::integrations::composio::ops::completed_sync_detail_for_test(7, true);
- assert!(
- re.captures(&capped).is_some(),
- "capped detail parses: {capped}"
- );
- assert!(capped.contains("more pending"));
-}