Skip to content

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

test(composio): thread dispatch ctx through file store and identity tests

Steven Enamakel7b8faf8cd3af
diff --git a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
index e91bd05d1f..ea340d28c9 100644
--- a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
@@ -97,7 +97,12 @@ async fn compute_required_connections_flags_missing_composio_toolkits() {
"edges": [ { "from_node": "t", "to_node": "send" } ]
});
let graph = tinyflows::migrate::deserialize_graph(graph_json).unwrap();
- let required = compute_required_connections(&crate::core::runtime::DispatchCtx::ambient(), &config, &graph).await;
+ let required = compute_required_connections(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &graph,
+ )
+ .await;
assert_eq!(required.len(), 1);
assert_eq!(required[0]["toolkit"], "gmail");
assert_eq!(required[0]["status"], "missing");
@@ -121,7 +126,12 @@ async fn compute_required_connections_skips_native_and_http_nodes() {
]
});
let graph = tinyflows::migrate::deserialize_graph(graph_json).unwrap();
- let required = compute_required_connections(&crate::core::runtime::DispatchCtx::ambient(), &config, &graph).await;
+ let required = compute_required_connections(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &graph,
+ )
+ .await;
assert!(
required.is_empty(),
"native oh: and http_request need no connection: {required:?}"
diff --git a/crates/openhuman-core/src/flows/ops_validate_warnings_and_connections_tests.rs b/crates/openhuman-core/src/flows/ops_validate_warnings_and_connections_tests.rs
index 30d32225ad..4b7f930317 100644
--- a/crates/openhuman-core/src/flows/ops_validate_warnings_and_connections_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_validate_warnings_and_connections_tests.rs
@@ -483,7 +483,9 @@ async fn flows_list_connections_aggregates_http_creds_and_tolerates_composio() {
.upsert(&HttpCredential::bearer("stripe", "sk_live_seed_secret"))
.unwrap();
- let outcome = flows_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &config).await.unwrap();
+ let outcome = flows_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &config)
+ .await
+ .unwrap();
let refs: Vec<_> = outcome
.value
.iter()
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
index 7c427de65e..66d0abc9ed 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
@@ -54,13 +54,21 @@ async fn the_file_store_dispatches_to_documents_when_a_backend_is_pinned() {
value.insert("gmail".to_string(), 7u32);
// Pin on this thread for the awaits below (a current-thread runtime).
super::TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = Some(docs.clone()));
- super::super::file_store::save(&crate::core::runtime::DispatchCtx::ambient(), &config, "composio_identities.json", &value)
- .await
- .unwrap();
- let loaded: BTreeMap<String, u32> =
- super::super::file_store::load(&crate::core::runtime::DispatchCtx::ambient(), &config, "composio_identities.json")
- .await
- .unwrap();
+ super::super::file_store::save(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "composio_identities.json",
+ &value,
+ )
+ .await
+ .unwrap();
+ let loaded: BTreeMap<String, u32> = super::super::file_store::load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "composio_identities.json",
+ )
+ .await
+ .unwrap();
super::TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = None);
assert_eq!(loaded, value);
assert!(!dir.path().join("storage").exists());
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_tests.rs b/crates/openhuman-core/src/integrations/composio/file_store_tests.rs
index b72e50dda8..2b9d6e5eec 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_tests.rs
@@ -11,7 +11,13 @@ fn config_in(dir: &tempfile::TempDir) -> Config {
#[tokio::test]
async fn missing_value_loads_the_default() {
let dir = tempfile::tempdir().unwrap();
- let loaded: BTreeMap<String, u32> = load(&config_in(&dir), IDENTITIES_FILE).await.unwrap();
+ let loaded: BTreeMap<String, u32> = load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config_in(&dir),
+ IDENTITIES_FILE,
+ )
+ .await
+ .unwrap();
assert!(loaded.is_empty());
}
@@ -21,11 +27,30 @@ async fn save_then_load_round_trips_in_the_workspace_default_backend() {
let config = config_in(&dir);
let mut value = BTreeMap::new();
value.insert("gmail".to_string(), 3u32);
- save(&config, USER_SCOPES_FILE, &value).await.unwrap();
- let loaded: BTreeMap<String, u32> = load(&config, USER_SCOPES_FILE).await.unwrap();
+ save(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ USER_SCOPES_FILE,
+ &value,
+ )
+ .await
+ .unwrap();
+ let loaded: BTreeMap<String, u32> = load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ USER_SCOPES_FILE,
+ )
+ .await
+ .unwrap();
assert_eq!(loaded, value);
// The other value is untouched, and nothing was written as a JSON file.
- let other: BTreeMap<String, u32> = load(&config, IDENTITIES_FILE).await.unwrap();
+ let other: BTreeMap<String, u32> = load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ IDENTITIES_FILE,
+ )
+ .await
+ .unwrap();
assert!(other.is_empty());
assert!(!dir.path().join("integrations").exists());
assert!(dir.path().join("storage").exists());
@@ -39,9 +64,29 @@ async fn update_applies_and_persists_a_change() {
*v.entry("n".into()).or_default() += 1;
((), true)
};
- update(&config, IDENTITIES_FILE, bump).await.unwrap();
- update(&config, IDENTITIES_FILE, bump).await.unwrap();
- let loaded: BTreeMap<String, u32> = load(&config, IDENTITIES_FILE).await.unwrap();
+ update(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ IDENTITIES_FILE,
+ bump,
+ )
+ .await
+ .unwrap();
+ update(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ IDENTITIES_FILE,
+ bump,
+ )
+ .await
+ .unwrap();
+ let loaded: BTreeMap<String, u32> = load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ IDENTITIES_FILE,
+ )
+ .await
+ .unwrap();
assert_eq!(loaded["n"], 2);
}
@@ -53,7 +98,13 @@ async fn a_legacy_state_file_is_imported_once_and_left_byte_identical() {
std::fs::create_dir_all(&legacy_dir).unwrap();
std::fs::write(legacy_dir.join(USER_SCOPES_FILE), r#"{"gmail":7}"#).unwrap();
- let loaded: BTreeMap<String, u32> = load(&config, USER_SCOPES_FILE).await.unwrap();
+ let loaded: BTreeMap<String, u32> = load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ USER_SCOPES_FILE,
+ )
+ .await
+ .unwrap();
assert_eq!(loaded["gmail"], 7);
// The legacy file is read only: same name, same bytes, no `.migrated`.
assert_eq!(
@@ -66,6 +117,7 @@ async fn a_legacy_state_file_is_imported_once_and_left_byte_identical() {
// A later edit is not clobbered by a re-import.
update(
+ &crate::core::runtime::DispatchCtx::ambient(),
&config,
USER_SCOPES_FILE,
|v: &mut BTreeMap<String, u32>| {
@@ -75,7 +127,13 @@ async fn a_legacy_state_file_is_imported_once_and_left_byte_identical() {
)
.await
.unwrap();
- let again: BTreeMap<String, u32> = load(&config, USER_SCOPES_FILE).await.unwrap();
+ let again: BTreeMap<String, u32> = load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ USER_SCOPES_FILE,
+ )
+ .await
+ .unwrap();
assert_eq!(again["gmail"], 9);
assert_eq!(
std::fs::read(legacy_dir.join(USER_SCOPES_FILE)).unwrap(),
diff --git a/crates/openhuman-core/src/integrations/composio/identity_store_tests.rs b/crates/openhuman-core/src/integrations/composio/identity_store_tests.rs
index ec2a58389e..af25d814fe 100644
--- a/crates/openhuman-core/src/integrations/composio/identity_store_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/identity_store_tests.rs
@@ -24,12 +24,19 @@ async fn persist_then_load_groups_fields_per_connection() {
let dir = tempfile::tempdir().unwrap();
let config = config_in(&dir);
- let written = persist_provider_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, &slack_profile("conn-1"))
- .await
- .unwrap();
+ let written = persist_provider_profile(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &slack_profile("conn-1"),
+ )
+ .await
+ .unwrap();
assert_eq!(written, 4);
- let identities = load_connected_identities(&crate::core::runtime::DispatchCtx::ambient(), &config).await.unwrap();
+ let identities =
+ load_connected_identities(&crate::core::runtime::DispatchCtx::ambient(), &config)
+ .await
+ .unwrap();
assert_eq!(identities.len(), 1);
let identity = &identities[0];
assert_eq!(identity.source, "slack");
@@ -43,9 +50,13 @@ async fn persist_then_load_groups_fields_per_connection() {
async fn persist_merges_into_the_stored_identity() {
let dir = tempfile::tempdir().unwrap();
let config = config_in(&dir);
- persist_provider_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, &slack_profile("conn-1"))
- .await
- .unwrap();
+ persist_provider_profile(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &slack_profile("conn-1"),
+ )
+ .await
+ .unwrap();
let partial = ProviderUserProfile {
toolkit: "slack".into(),
@@ -53,9 +64,18 @@ async fn persist_merges_into_the_stored_identity() {
display_name: Some("Ada L.".into()),
..ProviderUserProfile::default()
};
- persist_provider_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, &partial).await.unwrap();
+ persist_provider_profile(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &partial,
+ )
+ .await
+ .unwrap();
- let identities = load_connected_identities(&crate::core::runtime::DispatchCtx::ambient(), &config).await.unwrap();
+ let identities =
+ load_connected_identities(&crate::core::runtime::DispatchCtx::ambient(), &config)
+ .await
+ .unwrap();
assert_eq!(identities.len(), 1);
assert_eq!(identities[0].display_name.as_deref(), Some("Ada L."));
assert_eq!(identities[0].user_id.as_deref(), Some("U123ABC"));
@@ -69,36 +89,77 @@ async fn empty_profile_writes_nothing() {
toolkit: "gmail".into(),
..ProviderUserProfile::default()
};
- assert_eq!(persist_provider_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, &empty).await.unwrap(), 0);
- let stored: Vec<ConnectedIdentity> = file_store::load(&crate::core::runtime::DispatchCtx::ambient(), &config, IDENTITIES_FILE).await.unwrap();
+ assert_eq!(
+ persist_provider_profile(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &empty
+ )
+ .await
+ .unwrap(),
+ 0
+ );
+ let stored: Vec<ConnectedIdentity> = file_store::load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ IDENTITIES_FILE,
+ )
+ .await
+ .unwrap();
assert!(stored.is_empty());
- assert!(load_connected_identities(&crate::core::runtime::DispatchCtx::ambient(), &config).await.unwrap().is_empty());
+ assert!(
+ load_connected_identities(&crate::core::runtime::DispatchCtx::ambient(), &config)
+ .await
+ .unwrap()
+ .is_empty()
+ );
}
#[tokio::test]
async fn delete_removes_only_the_named_connection() {
let dir = tempfile::tempdir().unwrap();
let config = config_in(&dir);
- persist_provider_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, &slack_profile("conn-1"))
- .await
- .unwrap();
- persist_provider_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, &slack_profile("conn-2"))
- .await
- .unwrap();
+ persist_provider_profile(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &slack_profile("conn-1"),
+ )
+ .await
+ .unwrap();
+ persist_provider_profile(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &slack_profile("conn-2"),
+ )
+ .await
+ .unwrap();
- let deleted = delete_connected_identity_facets(&crate::core::runtime::DispatchCtx::ambient(), &config, "SLACK", "conn-1")
- .await
- .unwrap();
+ let deleted = delete_connected_identity_facets(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "SLACK",
+ "conn-1",
+ )
+ .await
+ .unwrap();
assert_eq!(deleted, 4);
- let identities = load_connected_identities(&crate::core::runtime::DispatchCtx::ambient(), &config).await.unwrap();
+ let identities =
+ load_connected_identities(&crate::core::runtime::DispatchCtx::ambient(), &config)
+ .await
+ .unwrap();
assert_eq!(identities.len(), 1);
assert_eq!(identities[0].identifier, "conn-2");
assert_eq!(
- delete_connected_identity_facets(&crate::core::runtime::DispatchCtx::ambient(), &config, "slack", "conn-1")
- .await
- .unwrap(),
+ delete_connected_identity_facets(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "slack",
+ "conn-1"
+ )
+ .await
+ .unwrap(),
0
);
}
diff --git a/crates/openhuman-core/src/integrations/composio/ops/scope_prefs_tests.rs b/crates/openhuman-core/src/integrations/composio/ops/scope_prefs_tests.rs
index 70a89fef69..133ec55c95 100644
--- a/crates/openhuman-core/src/integrations/composio/ops/scope_prefs_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops/scope_prefs_tests.rs
@@ -45,9 +45,14 @@ async fn a_legacy_pref_either_reaches_the_module_or_stays_stored() {
let dir = tempfile::tempdir().unwrap();
let config = config_in(&dir);
let legacy = serde_json::json!({"github":{"read":true,"write":false,"admin":true}});
- file_store::save(&crate::core::runtime::DispatchCtx::ambient(), &config, USER_SCOPES_FILE, &legacy)
- .await
- .unwrap();
+ file_store::save(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ USER_SCOPES_FILE,
+ &legacy,
+ )
+ .await
+ .unwrap();
let stored = UserScopePref {
read: true,
write: false,
@@ -56,7 +61,13 @@ async fn a_legacy_pref_either_reaches_the_module_or_stays_stored() {
let pref = load_or_default(&config, "github").await;
let done = migrated().lock().unwrap().contains(&config.workspace_dir);
- let left: LegacyScopeFile = file_store::load(&crate::core::runtime::DispatchCtx::ambient(), &config, USER_SCOPES_FILE).await.unwrap();
+ let left: LegacyScopeFile = file_store::load(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ USER_SCOPES_FILE,
+ )
+ .await
+ .unwrap();
if done {
assert_eq!(pref, stored, "the migrated row must decide visibility");
assert!(left.is_empty(), "the stored value is emptied once moved");
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 7147302e6a..6981a6a3d4 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
@@ -177,9 +177,14 @@ async fn composio_authorize_routes_through_direct_mode() {
// "composio unavailable / no backend session" instead.
let tmp = tempfile::tempdir().unwrap();
let config = direct_mode_config(&tmp);
- let err = composio_authorize(&crate::core::runtime::DispatchCtx::host_default(), &config, "gmail", None)
- .await
- .unwrap_err();
+ let err = composio_authorize(
+ &crate::core::runtime::DispatchCtx::host_default(),
+ &config,
+ "gmail",
+ None,
+ )
+ .await
+ .unwrap_err();
assert!(
!err.contains("no backend session"),
"direct mode must not surface backend-auth errors, got: {err}"
@@ -484,7 +489,12 @@ async fn enrich_does_nothing_when_no_cached_identities() {
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);
let resp = make_connections_response(&[("c1", "gmail", "ACTIVE")]);
- let enriched = enrich_connections_with_identity(&config, resp).await;
+ let enriched = enrich_connections_with_identity(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ resp,
+ )
+ .await;
assert_eq!(enriched.connections.len(), 1);
assert!(enriched.connections[0].account_email.is_none());
assert!(enriched.connections[0].workspace.is_none());
@@ -501,7 +511,12 @@ async fn enrich_skips_connection_already_having_identity() {
let mut resp = make_connections_response(&[("c-preloaded", "gmail", "ACTIVE")]);
resp.connections[0].account_email = Some("[email protected]".to_string());
- let enriched = enrich_connections_with_identity(&config, resp).await;
+ let enriched = enrich_connections_with_identity(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ resp,
+ )
+ .await;
assert_eq!(
enriched.connections[0].account_email.as_deref(),
@@ -520,7 +535,8 @@ async fn enrich_leaves_unmatched_connection_unchanged() {
let config = test_config(&tmp);
// Persist a profile for a DIFFERENT connection id.
- persist_provider_profile(&crate::core::runtime::DispatchCtx::ambient(),
+ persist_provider_profile(
+ &crate::core::runtime::DispatchCtx::ambient(),
&config,
&ProviderUserProfile {
toolkit: "gmail".to_string(),
@@ -533,7 +549,12 @@ async fn enrich_leaves_unmatched_connection_unchanged() {
.expect("persist provider profile");
let resp = make_connections_response(&[("no-profile-conn", "gmail", "ACTIVE")]);
- let enriched = enrich_connections_with_identity(&config, resp).await;
+ let enriched = enrich_connections_with_identity(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ resp,
+ )
+ .await;
assert!(
enriched.connections[0].account_email.is_none(),
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 1fb05284d4..3160e6b5fb 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
@@ -578,7 +578,8 @@ async fn composio_list_connections_routes_through_direct_mode() {
// remote will reject the test request, so we assert on the error
// shape: it must reference `composio` AND must NOT reference the
// backend-session path (proving the factory routed us to direct).
- let result = composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &config).await;
+ let result =
+ composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &config).await;
match result {
Ok(outcome) => {
// Some sandboxes resolve OK with an empty list — accept
diff --git a/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs
index 21712187c9..e0bc7e78b5 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs
@@ -57,7 +57,9 @@ async fn composio_list_connections_is_quietly_unavailable_without_session() {
// answer and the reconcile / flows callers keep their fail-open handling —
// but nothing is reported to Sentry, and the JSON-RPC boundary demotes the
// wording as expected user state (`is_session_expired_message`).
- let err = composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &config).await.unwrap_err();
+ let err = composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &config)
+ .await
+ .unwrap_err();
assert!(
err.contains("no backend session token"),
"the error should say what is missing: {err}"
@@ -76,9 +78,14 @@ async fn composio_authorize_errors_without_session() {
let _serialised = module_guard().await;
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);
- let err = composio_authorize(&crate::core::runtime::DispatchCtx::host_default(), &config, "gmail", None)
- .await
- .unwrap_err();
+ let err = composio_authorize(
+ &crate::core::runtime::DispatchCtx::host_default(),
+ &config,
+ "gmail",
+ None,
+ )
+ .await
+ .unwrap_err();
// Backend mode (default) without a session — the mode-aware factory
// surfaces "no backend session token" once `composio_authorize`
// routes through `resolve_composio_route`. Accept either the
@@ -97,9 +104,13 @@ async fn composio_delete_connection_errors_without_session() {
let _serialised = module_guard().await;
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);
- let err = composio_delete_connection(&crate::core::runtime::DispatchCtx::ambient(), &config, "c-1")
- .await
- .unwrap_err();
+ let err = composio_delete_connection(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "c-1",
+ )
+ .await
+ .unwrap_err();
assert!(
err.to_lowercase().contains("composio")
&& (err.contains("unavailable") || err.contains("route")),
@@ -150,7 +161,13 @@ async fn composio_get_user_profile_errors_without_session() {
let _serialised = module_guard().await;
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);
- let err = composio_get_user_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, "c-1").await.unwrap_err();
+ let err = composio_get_user_profile(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "c-1",
+ )
+ .await
+ .unwrap_err();
// Fails while resolving which toolkit `c-1` belongs to, because that needs
// the connection list and the connection list needs a credential. Still a
// failure that names the domain, which is the contract here.
@@ -235,7 +252,9 @@ async fn composio_list_connections_via_mock_counts_active() {
let base = start_mock_backend(app).await;
let tmp = tempfile::tempdir().unwrap();
let config = config_with_backend(&tmp, base);
- let outcome = composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &config).await.unwrap();
+ let outcome = composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &config)
+ .await
+ .unwrap();
assert_eq!(outcome.value.connections.len(), 3);
// 2 active, 3 total
assert!(outcome.logs.iter().any(|l| l.contains("3 connection")));
@@ -262,7 +281,10 @@ async fn composio_list_connections_drops_the_module_route_once_signed_out() {
let signed_in_tmp = tempfile::tempdir().unwrap();
let signed_in = config_with_backend(&signed_in_tmp, base);
// Signed in: the module is loaded and routed to the mock backend.
- let outcome = composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &signed_in).await.unwrap();
+ let outcome =
+ composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &signed_in)
+ .await
+ .unwrap();
assert_eq!(outcome.value.connections.len(), 1);
assert!(
!last_route_is_none(),
@@ -276,7 +298,9 @@ async fn composio_list_connections_drops_the_module_route_once_signed_out() {
// answering.
let signed_out_tmp = tempfile::tempdir().unwrap();
let signed_out = test_config(&signed_out_tmp);
- let err = composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &signed_out).await.unwrap_err();
+ let err = composio_list_connections(&crate::core::runtime::DispatchCtx::ambient(), &signed_out)
+ .await
+ .unwrap_err();
assert!(err.contains("no backend session token"), "{err}");
assert!(
last_route_is_none(),
@@ -348,9 +372,14 @@ async fn composio_authorize_clears_pending_meta_connection_before_handoff() {
let base = start_mock_backend(app).await;
let tmp = tempfile::tempdir().unwrap();
let config = config_with_backend(&tmp, base);
- let outcome = composio_authorize(&crate::core::runtime::DispatchCtx::host_default(), &config, "instagram", None)
- .await
- .unwrap();
+ let outcome = composio_authorize(
+ &crate::core::runtime::DispatchCtx::host_default(),
+ &config,
+ "instagram",
+ None,
+ )
+ .await
+ .unwrap();
assert_eq!(outcome.value.connection_id, "c-new");
assert_eq!(deletes.load(Ordering::SeqCst), 1);
}
@@ -370,7 +399,14 @@ async fn composio_authorize_via_mock_publishes_event_and_returns_url() {
let base = start_mock_backend(app).await;
let tmp = tempfile::tempdir().unwrap();
let config = config_with_backend(&tmp, base);
- let outcome = composio_authorize(&crate::core::runtime::DispatchCtx::host_default(), &config, "gmail", None).await.unwrap();
+ let outcome = composio_authorize(
+ &crate::core::runtime::DispatchCtx::host_default(),
+ &config,
+ "gmail",
+ None,
+ )
+ .await
+ .unwrap();
assert_eq!(outcome.value.connect_url, "https://x");
assert_eq!(outcome.value.connection_id, "c1");
}
@@ -387,6 +423,9 @@ async fn composio_delete_connection_via_mock() {
let base = start_mock_backend(app).await;
let tmp = tempfile::tempdir().unwrap();
let config = config_with_backend(&tmp, base);
- let outcome = composio_delete_connection(&crate::core::runtime::DispatchCtx::ambient(), &config, "c1").await.unwrap();
+ let outcome =
+ composio_delete_connection(&crate::core::runtime::DispatchCtx::ambient(), &config, "c1")
+ .await
+ .unwrap();
assert!(outcome.value.deleted);
}
diff --git a/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
index 0df0d53f35..f03743799b 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
@@ -64,7 +64,10 @@ async fn composio_get_user_profile_via_mock_returns_provider_profile() {
let _workspace_env_guard = EnvVarGuard::workspace_unlocked(tmp.path());
config.save().await.unwrap();
- let outcome = composio_get_user_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, "c1").await.unwrap();
+ let outcome =
+ composio_get_user_profile(&crate::core::runtime::DispatchCtx::ambient(), &config, "c1")
+ .await
+ .unwrap();
assert_eq!(outcome.value.toolkit, "gmail");
assert_eq!(outcome.value.connection_id.as_deref(), Some("c1"));
@@ -205,7 +208,8 @@ async fn composio_list_tools_honours_a_preference_still_in_the_legacy_file() {
let base = start_mock_backend(app).await;
let tmp = tempfile::tempdir().unwrap();
let config = config_with_backend(&tmp, base);
- crate::integrations::composio::file_store::save(&crate::core::runtime::DispatchCtx::ambient(),
+ crate::integrations::composio::file_store::save(
+ &crate::core::runtime::DispatchCtx::ambient(),
&config,
crate::integrations::composio::file_store::USER_SCOPES_FILE,
&json!({"gmail": {"read": true, "write": false, "admin": false}}),
diff --git a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
index 043e07ea4d..ce1fabbffb 100644
--- a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
@@ -155,7 +155,8 @@ async fn a_preference_still_in_the_legacy_file_gates_execution() {
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
config.config_path = tmp.path().join("config.toml");
- crate::integrations::composio::file_store::save(&crate::core::runtime::DispatchCtx::ambient(),
+ crate::integrations::composio::file_store::save(
+ &crate::core::runtime::DispatchCtx::ambient(),
&config,
crate::integrations::composio::file_store::USER_SCOPES_FILE,
&serde_json::json!({"gmail": {"read": true, "write": false, "admin": false}}),