Skip to content

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

test: update tests for ledger sync and approval store signatures

Steven Enamakel9a6a3fb1d0db
diff --git a/crates/openhuman-core/src/agent/session_store/rebound_tests.rs b/crates/openhuman-core/src/agent/session_store/rebound_tests.rs
index 243227ee8b..28d9f20540 100644
--- a/crates/openhuman-core/src/agent/session_store/rebound_tests.rs
+++ b/crates/openhuman-core/src/agent/session_store/rebound_tests.rs
@@ -32,7 +32,12 @@ fn handles_opened_before_a_rebind_keep_their_backend() {
rebind_all(&second);
let new = stores.try_for_agent("agent").unwrap();
old.turn_states
- .put(&tinyagents_session::turn_state::TurnState::default())
+ .put(&tinyagents_session::turn_state::TurnState::started(
+ "t",
+ "r",
+ 4,
+ "2026-01-01T00:00:00Z",
+ ))
.ok();
assert!(
!Arc::ptr_eq(&old.turn_states, &new.turn_states),
diff --git a/crates/openhuman-core/src/desktop/notifications/store_tests_2_tests.rs b/crates/openhuman-core/src/desktop/notifications/store_tests_2_tests.rs
index db99f53eb3..67f98234c5 100644
--- a/crates/openhuman-core/src/desktop/notifications/store_tests_2_tests.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store_tests_2_tests.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::config::Config;
+use chrono::Utc;
use std::sync::{Arc, Barrier};
use tempfile::TempDir;
diff --git a/crates/openhuman-core/src/security/approval/store_documents_tests.rs b/crates/openhuman-core/src/security/approval/store_documents_tests.rs
index e8b3758249..74114b9dec 100644
--- a/crates/openhuman-core/src/security/approval/store_documents_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_documents_tests.rs
@@ -334,10 +334,8 @@ fn sub_second_timestamps_order_and_expire_on_time() {
fn a_captured_store_decides_without_the_task_scope() {
let store = docs();
store.insert_pending(&pending("r", 0, None), "s").unwrap();
- let config = crate::config::Config::default();
let decided = crate::security::approval::store::decide_captured(
- &config,
- &Ok(Some(store.clone())),
+ &Ok(store.clone()),
"r",
ApprovalDecision::Deny,
)
@@ -346,11 +344,9 @@ fn a_captured_store_decides_without_the_task_scope() {
}
#[test]
-fn an_unresolved_scope_fails_the_captured_decide_instead_of_using_sqlite() {
- let config = crate::config::Config::default();
+fn an_unresolved_scope_fails_the_captured_decide_instead_of_using_another_scope() {
let captured = Err("no acting agent".to_string());
let error = crate::security::approval::store::decide_captured(
- &config,
&captured,
"r",
ApprovalDecision::Deny,
diff --git a/crates/openhuman-core/src/security/approval/store_tests.rs b/crates/openhuman-core/src/security/approval/store_tests.rs
index 56af8dd276..4b62b757eb 100644
--- a/crates/openhuman-core/src/security/approval/store_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::security::approval::types::{ApprovalDecision, PendingApproval};
-use chrono::Duration;
+use chrono::{DateTime, Duration, Utc};
use serde_json::json;
use crate::storage::{DocumentStore, DocumentStoreExt};
use tempfile::TempDir;
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 51e55a0a15..2d8b74763f 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -3668,7 +3668,7 @@ async fn json_rpc_run_ledger_lifecycle() {
.await
.expect("load config");
- tinyagents_session::run_ledger::upsert_agent_run(
+ openhuman::agent::session_store::ledger_sync::upsert_agent_run(
&config.workspace_dir,
tinyagents_session::run_ledger::AgentRunUpsert {
id: "sub-run-1".to_string(),
@@ -3693,7 +3693,7 @@ async fn json_rpc_run_ledger_lifecycle() {
)
.expect("seed run");
- tinyagents_session::run_ledger::append_run_event(
+ openhuman::agent::session_store::ledger_sync::append_run_event(
&config.workspace_dir,
tinyagents_session::run_ledger::RunEventAppend {
run_id: "sub-run-1".to_string(),
@@ -3785,9 +3785,8 @@ async fn json_rpc_agent_work_list_groups_runs_by_bucket() {
.await
.expect("load config");
- use tinyagents_session::run_ledger::{
- upsert_agent_run, AgentRunKind, AgentRunStatus, AgentRunUpsert,
- };
+ use openhuman::agent::session_store::ledger_sync::upsert_agent_run;
+ use tinyagents_session::run_ledger::{AgentRunKind, AgentRunStatus, AgentRunUpsert};
let seed = |id: &str, status: AgentRunStatus| AgentRunUpsert {
id: id.to_string(),
kind: AgentRunKind::Subagent,
@@ -3914,7 +3913,7 @@ async fn json_rpc_workflow_run_definitions_and_runs_roundtrip() {
);
// Seed a durable workflow run, then list + get it.
- tinyagents_session::run_ledger::upsert_workflow_run(
+ openhuman::agent::session_store::ledger_sync::upsert_workflow_run(
&config.workspace_dir,
tinyagents_session::run_ledger::WorkflowRunUpsert {
id: "wf-run-1".to_string(),
@@ -4113,10 +4112,10 @@ async fn json_rpc_agent_team_coordination_roundtrip() {
// Mark A done directly via the run ledger, then B claims fine.
let task_a =
- tinyagents_session::run_ledger::get_agent_team_task(&config.workspace_dir, &task_a_id)
+ openhuman::agent::session_store::ledger_sync::get_agent_team_task(&config.workspace_dir, &task_a_id)
.expect("get task A")
.expect("task A present");
- tinyagents_session::run_ledger::upsert_agent_team_task(
+ openhuman::agent::session_store::ledger_sync::upsert_agent_team_task(
&config.workspace_dir,
tinyagents_session::run_ledger::AgentTeamTaskUpsert {
id: task_a.id.clone(),