Skip to content

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

fix(jev): use relocated redact_url_for_log helper

Steven Enamakela8ed09487a4a
diff --git a/crates/openhuman-tinyhumans/src/jev/ranker.rs b/crates/openhuman-tinyhumans/src/jev/ranker.rs
index 08de6dd073..c6e309b0d5 100644
--- a/crates/openhuman-tinyhumans/src/jev/ranker.rs
+++ b/crates/openhuman-tinyhumans/src/jev/ranker.rs
@@ -90,7 +90,7 @@ impl TinyHumansJevRanker {
let ranker = JevRanker::from_config(client, self.config.clone())?;
log::info!(
"[tool-search] jev ranker bound to backend {} ({})",
- openhuman_core::api::config::redact_url_for_log(&base_url),
+ openhuman_core::util::redact::redact_url_for_log(&base_url),
if fingerprint_changed(cached.as_ref(), fingerprint) {
"credential or backend changed"
} else {
diff --git a/crates/openhuman-tinyhumans/src/jev/ranker_tests.rs b/crates/openhuman-tinyhumans/src/jev/ranker_tests.rs
new file mode 100644
index 0000000000..84622f3d7e
--- /dev/null
+++ b/crates/openhuman-tinyhumans/src/jev/ranker_tests.rs
@@ -0,0 +1,48 @@
+use tinytools::{RankCandidate, RankContext, RankError, ToolRanker};
+
+use super::*;
+
+#[test]
+fn kind_is_jev_and_debug_hides_the_client() {
+ let ranker = TinyHumansJevRanker::new();
+ assert_eq!(ranker.kind(), "jev");
+ let debug = format!("{ranker:?}");
+ assert!(debug.contains("TinyHumansJevRanker"));
+ assert!(!debug.contains("api_key"));
+}
+
+#[test]
+fn fingerprint_changes_with_secret_or_base_url() {
+ let a = fingerprint("secret", "https://api.tinyhumans.ai");
+ assert_eq!(a, fingerprint("secret", "https://api.tinyhumans.ai"));
+ assert_ne!(a, fingerprint("other", "https://api.tinyhumans.ai"));
+ assert_ne!(a, fingerprint("secret", "https://staging.tinyhumans.ai"));
+ assert!(!fingerprint_changed(None, a));
+}
+
+/// Without a credential the ranker must answer with a `Backend` error the
+/// harness turns into a BM25 fallback — never a panic, never a network call.
+#[tokio::test]
+async fn no_credential_is_a_backend_error_naming_the_gap() {
+ let tmp = tempfile::tempdir().expect("tempdir");
+ let _guard = openhuman_core::config::test_support::EnvGuard::set_home(tmp.path());
+ let ranker = TinyHumansJevRanker::new();
+ let err = ranker
+ .rank(
+ "send a message",
+ &RankContext::empty(),
+ &[RankCandidate::new("a", "a send a message")],
+ 3,
+ )
+ .await
+ .expect_err("no credential must fail");
+ match err {
+ RankError::Backend { reason } => {
+ assert!(
+ reason.contains("no TinyHumans credential") || reason.contains("config"),
+ "{reason}"
+ );
+ }
+ other => panic!("expected a backend error, got {other}"),
+ }
+}