Skip to content

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

fix(test): update test module paths after restructuring

Steven Enamakelabb80249b30b
diff --git a/crates/openhuman-core/src/channels/controllers/schemas_tests.rs b/crates/openhuman-core/src/channels/controllers/schemas_tests.rs
index 142c8b7940..38528de5d5 100644
--- a/crates/openhuman-core/src/channels/controllers/schemas_tests.rs
+++ b/crates/openhuman-core/src/channels/controllers/schemas_tests.rs
@@ -115,3 +115,20 @@ fn schema_adapter_preserves_optional_field_type() {
TypeSchema::Option(inner) if matches!(inner.as_ref(), TypeSchema::Bool)
));
}
+
+#[test]
+fn hosted_link_functions_are_not_served_by_the_core() {
+ // `channels.telegram_login_*` / `channels.discord_link_*` need a TinyHumans
+ // account and are registered by `openhuman-tinyhumans`; the core must not
+ // register them too (the extension would collide) nor advertise them.
+ let names: Vec<&str> = all_controller_schemas().iter().map(|s| s.function).collect();
+ let registered: Vec<&str> = all_registered_controllers()
+ .iter()
+ .map(|c| c.schema.function)
+ .collect();
+ for f in HOSTED_CHANNEL_FUNCTIONS {
+ assert!(!names.contains(f), "core schema still lists `{f}`");
+ assert!(!registered.contains(f), "core still registers `{f}`");
+ }
+ assert!(names.contains(&"send_message"));
+}
diff --git a/crates/openhuman-core/src/security/credentials/session_support_tests.rs b/crates/openhuman-core/src/security/credentials/session_support_tests.rs
index 0c84933c75..967471190f 100644
--- a/crates/openhuman-core/src/security/credentials/session_support_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/session_support_tests.rs
@@ -391,3 +391,46 @@ fn classify_expired_within_skew_window() {
SessionTokenCheck::Expired
);
}
+
+// ── direct_backend_credential ──────────────────────────────────
+
+#[test]
+fn direct_backend_credential_skips_without_a_usable_credential() {
+ let tmp = TempDir::new().unwrap();
+ let config = test_config(&tmp);
+ // Signed out: nothing to authenticate a direct backend call with.
+ assert!(direct_backend_credential(&config, "test").is_none());
+
+ // The offline local session has no TinyHumans account (Sentry 36649).
+ AuthService::from_config(&config)
+ .store_provider_token(
+ APP_SESSION_PROVIDER,
+ DEFAULT_AUTH_PROFILE_NAME,
+ "desktop.test.local",
+ std::collections::HashMap::new(),
+ true,
+ )
+ .unwrap();
+ assert!(direct_backend_credential(&config, "test").is_none());
+}
+
+#[test]
+fn direct_backend_credential_returns_a_live_session() {
+ let tmp = TempDir::new().unwrap();
+ let config = test_config(&tmp);
+ AuthService::from_config(&config)
+ .store_provider_token(
+ APP_SESSION_PROVIDER,
+ DEFAULT_AUTH_PROFILE_NAME,
+ "raw-session-token",
+ std::collections::HashMap::new(),
+ true,
+ )
+ .unwrap();
+ // Unit tests resolve the plain test transport, so the transport gate passes.
+ assert!(crate::api::transport::is_installed());
+ assert_eq!(
+ direct_backend_credential(&config, "test"),
+ Some(BackendCredential::Session("raw-session-token".into()))
+ );
+}
diff --git a/crates/openhuman-core/src/security/credentials/tools_tests.rs b/crates/openhuman-core/src/security/credentials/tools_tests.rs
index 0b98191fb7..699f218bbe 100644
--- a/crates/openhuman-core/src/security/credentials/tools_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/tools_tests.rs
@@ -25,3 +25,31 @@ async fn oauth_connect_requires_provider() {
.expect_err("missing provider");
assert!(err.to_string().contains("provider"));
}
+
+#[tokio::test]
+async fn oauth_tools_report_backend_unavailable_without_the_hosted_layer() {
+ // The core alone does not register `auth.oauth_*` (they live in
+ // `openhuman-tinyhumans`), so the tools answer the demoted sentinel.
+ let err = OAuthListTool::new(cfg())
+ .execute(json!({}))
+ .await
+ .expect_err("no hosted layer");
+ assert!(
+ err.to_string().contains("BACKEND_UNAVAILABLE:"),
+ "{err}"
+ );
+ let err = OAuthConnectUrlTool::new(cfg())
+ .execute(json!({"provider": "github", "skill_id": "s"}))
+ .await
+ .expect_err("no hosted layer");
+ assert!(err.to_string().contains("BACKEND_UNAVAILABLE:"), "{err}");
+}
+
+#[test]
+fn strip_log_envelope_unwraps_only_the_result_envelope() {
+ assert_eq!(
+ strip_log_envelope(json!({"result": {"a": 1}, "logs": ["x"]})),
+ json!({"a": 1})
+ );
+ assert_eq!(strip_log_envelope(json!({"a": 1})), json!({"a": 1}));
+}