Skip to content

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

style: apply rustfmt formatting across embed and tinyhumans crates

Steven Enamakel050c1cbfd565
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index 78e6f716ea..0771bb35d8 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -39,9 +39,10 @@ pub mod core {
pub use openhuman_core::core::observability::{
contains_transient_transport_phrase, expected_error_kind, is_api_key_rejected_message,
is_session_expired_message, is_suppressed_usage_probe_backoff,
- is_transient_http_status_code, is_transient_message_failure, report_error, report_error_or_expected,
- report_warning_message, ExpectedErrorKind, API_KEY_REJECTED_PREFIX,
- BACKEND_UNAVAILABLE_PREFIX, REPORT_ERROR_TRACING_TARGET, USAGE_PROBE_BACKOFF_PREFIX,
+ is_transient_http_status_code, is_transient_message_failure, report_error,
+ report_error_or_expected, report_warning_message, ExpectedErrorKind,
+ API_KEY_REJECTED_PREFIX, BACKEND_UNAVAILABLE_PREFIX, REPORT_ERROR_TRACING_TARGET,
+ USAGE_PROBE_BACKOFF_PREFIX,
};
}
diff --git a/crates/openhuman-tinyhumans/src/client/backend_channel_tests.rs b/crates/openhuman-tinyhumans/src/client/backend_channel_tests.rs
index 3489f3356a..9edab0b3ad 100644
--- a/crates/openhuman-tinyhumans/src/client/backend_channel_tests.rs
+++ b/crates/openhuman-tinyhumans/src/client/backend_channel_tests.rs
@@ -417,9 +417,7 @@ async fn unavailable_transport_flattens_to_the_backend_unavailable_sentinel() {
assert!(matches!(typed, HostedApiError::BackendUnavailable { .. }));
let flat = flatten_authed_error(err);
assert!(
- flat.starts_with(
- openhuman_embed::__host::core::observability::BACKEND_UNAVAILABLE_PREFIX
- ),
+ flat.starts_with(openhuman_embed::__host::core::observability::BACKEND_UNAVAILABLE_PREFIX),
"{flat}"
);
assert!(flat.contains("GET /teams/me/usage"), "{flat}");
diff --git a/crates/openhuman-tinyhumans/src/client/endpoint.rs b/crates/openhuman-tinyhumans/src/client/endpoint.rs
index 97a520d02f..f13d02c1a8 100644
--- a/crates/openhuman-tinyhumans/src/client/endpoint.rs
+++ b/crates/openhuman-tinyhumans/src/client/endpoint.rs
@@ -49,8 +49,10 @@ pub fn is_managed_endpoint_for_api_key(endpoint: &str) -> bool {
if !is_safe_endpoint_for_managed_bearer(endpoint) {
return false;
}
- let managed =
- url.scheme() == "https" && url.host_str().is_some_and(|h| MANAGED_API_KEY_HOSTS.contains(&h));
+ let managed = url.scheme() == "https"
+ && url
+ .host_str()
+ .is_some_and(|h| MANAGED_API_KEY_HOSTS.contains(&h));
managed || is_loopback_host(&url)
}
diff --git a/crates/openhuman-tinyhumans/src/client/enricher_tests.rs b/crates/openhuman-tinyhumans/src/client/enricher_tests.rs
index a76884fe32..13a18bff9b 100644
--- a/crates/openhuman-tinyhumans/src/client/enricher_tests.rs
+++ b/crates/openhuman-tinyhumans/src/client/enricher_tests.rs
@@ -23,8 +23,14 @@ fn socket_url_swaps_scheme_and_appends_the_handshake() {
#[test]
fn a_loopback_api_url_override_drives_every_derived_field() {
let resolved = resolve(&config_with(Some("http://127.0.0.1:18765")));
- assert_eq!(resolved.control_plane_url.as_deref(), Some("http://127.0.0.1:18765"));
- assert_eq!(resolved.inference_url.as_deref(), Some("http://127.0.0.1:18765"));
+ assert_eq!(
+ resolved.control_plane_url.as_deref(),
+ Some("http://127.0.0.1:18765")
+ );
+ assert_eq!(
+ resolved.inference_url.as_deref(),
+ Some("http://127.0.0.1:18765")
+ );
assert_eq!(
resolved.socket_url.as_deref(),
Some("ws://127.0.0.1:18765/socket.io/?EIO=4&transport=websocket")
@@ -67,7 +73,10 @@ fn control_plane_and_inference_follow_the_same_rules_as_the_transport() {
fn attribution_headers_and_identity_come_from_this_crate() {
let resolved = resolve(&config_with(None));
let identity = crate::backend::product::product_identity();
- assert_eq!(resolved.product_identity.as_deref(), Some(identity.as_str()));
+ assert_eq!(
+ resolved.product_identity.as_deref(),
+ Some(identity.as_str())
+ );
let (name, _) = crate::backend::product::product_identity_header();
let sdk_name = resolved
.attribution_headers
diff --git a/crates/openhuman-tinyhumans/src/client/integrations_http.rs b/crates/openhuman-tinyhumans/src/client/integrations_http.rs
index 85e0c3d6e7..63d403ae1f 100644
--- a/crates/openhuman-tinyhumans/src/client/integrations_http.rs
+++ b/crates/openhuman-tinyhumans/src/client/integrations_http.rs
@@ -17,9 +17,9 @@ use openhuman_embed::__host::backend::transport::{
BackendTransport, BackendTransportError, TransportProfile,
};
use openhuman_embed::__host::security::credentials::session_support::BackendCredential;
+use openhuman_embed::__host::util::redact_url_for_log;
use openhuman_embed::__host::util::tls::tls_client_builder;
use openhuman_embed::__host::util::url::{join_url, normalize_backend_api_base_url};
-use openhuman_embed::__host::util::redact_url_for_log;
use openhuman_embed::BackendRequest;
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
use reqwest::Method;
@@ -227,9 +227,7 @@ impl IntegrationsHttp {
.map_err(|e| BackendTransportError::Other(e.to_string()))?;
let transport = self.resolve_transport()?;
log::trace!("{LOG_PREFIX} {} {path}", method.as_str());
- transport
- .send_json(self.request(method, path, body))
- .await
+ transport.send_json(self.request(method, path, body)).await
}
/// Send a `multipart/form-data` upload and return the response body.
diff --git a/crates/openhuman-tinyhumans/src/client/integrations_http_tests.rs b/crates/openhuman-tinyhumans/src/client/integrations_http_tests.rs
index a5f249b91e..895463930b 100644
--- a/crates/openhuman-tinyhumans/src/client/integrations_http_tests.rs
+++ b/crates/openhuman-tinyhumans/src/client/integrations_http_tests.rs
@@ -20,12 +20,11 @@ fn sanitize_strips_inference_paths_and_is_idempotent() {
#[test]
fn privileged_paths_are_refused_before_sending() {
- for route in [
- "/webhooks/x",
- "/agent-integrations/admin/y",
- "/a/ADMIN?q=1",
- ] {
- assert!(reject_privileged_backend_path("GET", route).is_err(), "{route}");
+ for route in ["/webhooks/x", "/agent-integrations/admin/y", "/a/ADMIN?q=1"] {
+ assert!(
+ reject_privileged_backend_path("GET", route).is_err(),
+ "{route}"
+ );
}
reject_privileged_backend_path("GET", "/agent-integrations/composio/connections").unwrap();
}
@@ -88,7 +87,10 @@ async fn send_json_surfaces_a_non_2xx_as_the_raw_status_error() {
.send_json(Method::POST, "/agent-integrations/x", Some(&json!({})))
.await
.unwrap_err();
- assert!(matches!(err, BackendTransportError::Status { status: 401, .. }), "{err:?}");
+ assert!(
+ matches!(err, BackendTransportError::Status { status: 401, .. }),
+ "{err:?}"
+ );
}
#[tokio::test]
@@ -108,7 +110,10 @@ async fn send_multipart_posts_a_form() {
let server = MockServer::start().await;
Mock::given(method("POST"))
.and(path("/agent-integrations/upload"))
- .respond_with(ResponseTemplate::new(200).set_body_json(json!({"success": true, "data": {"ok": true}})))
+ .respond_with(
+ ResponseTemplate::new(200)
+ .set_body_json(json!({"success": true, "data": {"ok": true}})),
+ )
.mount(&server)
.await;
@@ -120,6 +125,14 @@ async fn send_multipart_posts_a_form() {
.unwrap();
assert_eq!(value["ok"], json!(true));
let received = server.received_requests().await.unwrap();
- let content_type = received[0].headers.get("content-type").unwrap().to_str().unwrap();
- assert!(content_type.starts_with("multipart/form-data"), "{content_type}");
+ let content_type = received[0]
+ .headers
+ .get("content-type")
+ .unwrap()
+ .to_str()
+ .unwrap();
+ assert!(
+ content_type.starts_with("multipart/form-data"),
+ "{content_type}"
+ );
}