Skip to content

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

chore(composio): add identity tests for composio integration

Steven Enamakel9aafe6f61fa7
diff --git a/src/openhuman/integrations/composio/identity_tests.rs b/src/openhuman/integrations/composio/identity_tests.rs
index 6131583c82..eedf51c745 100644
--- a/src/openhuman/integrations/composio/identity_tests.rs
+++ b/src/openhuman/integrations/composio/identity_tests.rs
@@ -1,60 +1,17 @@
use super::*;
-use crate::openhuman::integrations::composio::providers::{
- register_provider, ComposioProvider, ProviderArc, ProviderUserProfile,
-};
-use async_trait::async_trait;
-use std::sync::atomic::{AtomicUsize, Ordering};
-/// Test provider that returns a fixed username (or fails, when
-/// `fail` is set). We don't go through Composio at all — the
-/// preflight gate just needs the provider's `username` field.
-struct StubProvider {
- slug: &'static str,
- username: Option<&'static str>,
- fail: bool,
- calls: AtomicUsize,
-}
-
-impl StubProvider {
- fn new(slug: &'static str, username: Option<&'static str>) -> Self {
- Self {
- slug,
- username,
- fail: false,
- calls: AtomicUsize::new(0),
- }
- }
- fn failing(slug: &'static str) -> Self {
- Self {
- slug,
- username: None,
- fail: true,
- calls: AtomicUsize::new(0),
- }
- }
-}
-
-#[async_trait]
-impl ComposioProvider for StubProvider {
- fn toolkit_slug(&self) -> &'static str {
- self.slug
- }
-
- async fn fetch_user_profile(
- &self,
- _ctx: &ProviderContext,
- ) -> Result<ProviderUserProfile, String> {
- self.calls.fetch_add(1, Ordering::SeqCst);
- if self.fail {
- return Err("stub provider: forced failure".to_string());
- }
- Ok(ProviderUserProfile {
- toolkit: self.slug.to_string(),
- username: self.username.map(|s| s.to_string()),
- ..Default::default()
- })
- }
-}
+// This file used to register a stub `ComposioProvider` under the engine's
+// provider registry so the third test below could prove
+// `connection_identity` short-circuits *before* calling `fetch_user_profile`
+// when the toolkit has no active connection. tinymemory v1.13.4 deleted
+// `ComposioProvider`/the registry outright with no replacement (see
+// `identity.rs`'s module docs) — `connection_identity` now calls the
+// `tinyconnectors` module's `GetUserProfile` directly rather than a
+// registered provider trait object, so there is no stub to register. None of
+// the three tests below ever reached that call anyway (all three assert the
+// short-circuit paths — empty toolkit, and "not in active integrations" — so
+// they are unaffected by the migration and are unchanged except for dropping
+// the now-nonexistent stub setup.
fn fresh_config_in_workspace(tmp: &std::path::Path) -> Config {
let mut config = Config::default();
@@ -76,7 +33,7 @@ async fn empty_toolkit_short_circuits_to_none() {
async fn unknown_toolkit_returns_none_without_provider_call() {
let tmp = tempfile::tempdir().expect("tempdir");
let config = fresh_config_in_workspace(tmp.path());
- // Toolkit slug that has no registered provider.
+ // Toolkit slug with no active connection.
assert!(connection_identity(&config, "not-a-real-toolkit-xyz")
.await
.is_none());
@@ -84,15 +41,8 @@ async fn unknown_toolkit_returns_none_without_provider_call() {
#[tokio::test]
async fn no_active_connection_short_circuits_before_provider_call() {
- // Register a provider but no connections exist for the toolkit
- // → identity helper should return None without calling
- // fetch_user_profile.
- let stub: ProviderArc = Arc::new(StubProvider::new(
- "stub-no-active",
- Some("would-not-be-returned"),
- ));
- register_provider(stub.clone());
-
+ // No connections exist for the toolkit → identity helper should return
+ // None without calling `GetUserProfile`.
let tmp = tempfile::tempdir().expect("tempdir");
let config = fresh_config_in_workspace(tmp.path());
// Default config has no Composio auth → fetch_connected_integrations