Skip to content

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

chore(core): remove outdated README and relocate rpc_log tests

Steven Enamakel5b608a7d7d3d
diff --git a/crates/openhuman-core/src/core/README.md b/crates/openhuman-core/src/core/README.md
index 2175cea9a2..7fc771b03f 100644
--- a/crates/openhuman-core/src/core/README.md
+++ b/crates/openhuman-core/src/core/README.md
@@ -49,7 +49,7 @@ logic. Every controller it exposes is implemented by a domain module under
| `legacy_aliases.rs` | `resolve_legacy`: rewrites retired method names before dispatch; mirrors `app/src/services/rpcMethods.ts`'s `LEGACY_METHOD_ALIASES`. |
| `observability.rs` | `report_error` + Sentry `before_send` filters that drop deterministic provider/updater noise. |
| `log_redaction.rs` | `scrub_secrets`: regex secret scrubbing shared by the Sentry path and always-on log path. |
-| `rpc_log.rs` | `redact_params_for_log` (key-name redaction for the `[rpc:dispatch]` trace log in `dispatch.rs`) plus `format_request_id` / `summarize_rpc_result` / `redact_result_for_trace` helpers with no caller yet. |
+| `rpc_log.rs` | `redact_params_for_log` (key-name redaction for the `[rpc:dispatch]` trace log in `dispatch.rs`) |
| `logging.rs` | `init_for_cli_run` / `init_for_embedded`: logger setup for each host kind. |
| `shutdown.rs` | Graceful shutdown signal plumbing. |
| `sentry_transport.rs` | Sentry client setup, gated by the `crash-reporting` feature. |
diff --git a/crates/openhuman-core/src/core/rpc_log.rs b/crates/openhuman-core/src/core/rpc_log.rs
index 92c11a3c48..bbd37c6295 100644
--- a/crates/openhuman-core/src/core/rpc_log.rs
+++ b/crates/openhuman-core/src/core/rpc_log.rs
@@ -1,15 +1,11 @@
-//! Request-id formatting and parameter redaction for RPC log lines.
+//! Parameter redaction for RPC log lines.
//!
//! [`redact_params_for_log`] is what `core::dispatch` calls for its
-//! `[rpc:dispatch] enter` trace line; [`format_request_id`],
-//! [`summarize_rpc_result`] and [`redact_result_for_trace`] are the matching
-//! helpers for transport-side request/response logging and currently have no
-//! caller outside this module's tests. [`redact_params_for_log`] and
-//! [`redact_result_for_trace`] strip the same set of sensitive keys —
+//! `[rpc:dispatch] enter` trace line. It strips a set of sensitive keys —
//! `api_key`, `apikey`, `token`, `access_token`, `refresh_token`,
//! `authorization`, `password`, `secret`, `client_secret` — from JSON objects
//! (recursing into nested objects/arrays) before a log line is emitted, since
-//! `serde_json::Value` params/results routinely embed provider credentials.
+//! `serde_json::Value` params routinely embed provider credentials.
//!
//! This is the log-side counterpart of `core::log_redaction::scrub_secrets`,
//! which pattern-matches secrets embedded in free-text error strings; this
@@ -17,19 +13,6 @@
use serde_json::Value;
-/// Formats a JSON-RPC request ID into a human-readable string.
-///
-/// Handles different JSON types (String, Number, Null) to ensure consistent
-/// output in log messages.
-pub fn format_request_id(id: &Value) -> String {
- match id {
- Value::String(s) => s.clone(),
- Value::Number(n) => n.to_string(),
- Value::Null => "null".to_string(),
- other => other.to_string(),
- }
-}
-
/// Redacts sensitive keys from a JSON parameters object before logging.
///
/// This is used to prevent accidental leakage of API keys, tokens, and passwords
@@ -38,30 +21,6 @@ pub fn redact_params_for_log(params: &Value) -> Value {
redact_value(params)
}
-/// Produces a short summary of a JSON value, useful for high-level logging.
-///
-/// Instead of printing a potentially massive object/array, it returns a
-/// string like `object(keys=foo,bar)` or `array(len=10)`.
-pub fn summarize_rpc_result(result: &Value) -> String {
- match result {
- Value::Object(map) => {
- let mut keys = map.keys().cloned().collect::<Vec<_>>();
- keys.sort();
- format!("object(keys={})", keys.join(","))
- }
- Value::Array(items) => format!("array(len={})", items.len()),
- Value::String(s) => format!("string(len={})", s.len()),
- Value::Bool(b) => format!("bool({b})"),
- Value::Number(n) => format!("number({n})"),
- Value::Null => "null".to_string(),
- }
-}
-
-/// Redacts sensitive keys from a JSON result object before trace logging.
-pub fn redact_result_for_trace(result: &Value) -> Value {
- redact_value(result)
-}
-
/// Recursively redacts sensitive information from a JSON value.
///
/// It traverses objects and arrays, replacing values of keys that match
@@ -99,7 +58,3 @@ fn is_sensitive_key(key: &str) -> bool {
| "client_secret"
)
}
-
-#[cfg(test)]
-#[path = "rpc_log_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/core/rpc_log_tests.rs b/crates/openhuman-core/src/core/rpc_log_tests.rs
deleted file mode 100644
index 201adbd8aa..0000000000
--- a/crates/openhuman-core/src/core/rpc_log_tests.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-use super::*;
-use serde_json::json;
-
-#[test]
-fn test_summarize_rpc_result() {
- assert_eq!(
- summarize_rpc_result(&json!({"b": 2, "a": 1})),
- "object(keys=a,b)"
- );
- assert_eq!(summarize_rpc_result(&json!({})), "object(keys=)");
- assert_eq!(summarize_rpc_result(&json!([1, 2, 3])), "array(len=3)");
- assert_eq!(summarize_rpc_result(&json!([])), "array(len=0)");
- assert_eq!(summarize_rpc_result(&json!("hello")), "string(len=5)");
- assert_eq!(summarize_rpc_result(&json!("")), "string(len=0)");
- assert_eq!(summarize_rpc_result(&json!(true)), "bool(true)");
- assert_eq!(summarize_rpc_result(&json!(false)), "bool(false)");
- assert_eq!(summarize_rpc_result(&json!(42)), "number(42)");
- // A float that is not an approximation of PI — clippy rejects 3.14 here.
- assert_eq!(summarize_rpc_result(&json!(2.5)), "number(2.5)");
- assert_eq!(summarize_rpc_result(&json!(null)), "null");
-}