The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore(memory): move RecordingProvider's inherent impl out of part 01
Shanub6c97e28f31d
diff --git a/src/openhuman/agent/harness/archivist/lifecycle_tests.rs b/src/openhuman/agent/harness/archivist/lifecycle_tests.rsindex 76693426ff..6604b56dbc 100644--- a/src/openhuman/agent/harness/archivist/lifecycle_tests.rs+++ b/src/openhuman/agent/harness/archivist/lifecycle_tests.rs@@ -14,6 +14,9 @@ use crate::openhuman::memory::guard::test_support::RecordingProvider;const SESSION: &str = "lifecycle-6156";+/// One episodic turn. `id` is load-bearing: the episodic read path builds its+/// `SessionEntry`s with `sequence: None`, so segment membership is decided on+/// `turn.id` against the segment's episodic-id bounds.fn turn(id: i64, role: &str, content: &str) -> EpisodicTurn {EpisodicTurn {id: Some(id),@@ -50,6 +53,7 @@ fn segment() -> ConversationSegment {}}+/// The driver's call log reduced to method names — what these tests assert on.fn methods(recording: &RecordingProvider) -> Vec<String> {recording.calls().into_iter().map(|c| c.method).collect()}diff --git a/src/openhuman/memory/guard/test_support_part_01.rs b/src/openhuman/memory/guard/test_support_part_01.rsindex 6e43ccd9e5..4b0f4fc355 100644--- a/src/openhuman/memory/guard/test_support_part_01.rs+++ b/src/openhuman/memory/guard/test_support_part_01.rs@@ -98,67 +98,6 @@ impl Default for RecordingProvider {}}-impl RecordingProvider {- pub fn new() -> Self {- Self {- calls: Mutex::new(Vec::new()),- recall_result: Mutex::new(Vec::new()),- fast_retrieve_result: Mutex::new(RetrievalResponse::default()),- namespace_hits: Mutex::new(Vec::new()),- namespace_summaries: Mutex::new(Vec::new()),- session_turns: Mutex::new(Vec::new()),- }- }-- pub fn with_recall_result(self, entries: Vec<MemoryEntry>) -> Self {- *self.recall_result.lock().unwrap() = entries;- self- }-- pub fn with_fast_retrieve_result(self, response: RetrievalResponse) -> Self {- *self.fast_retrieve_result.lock().unwrap() = response;- self- }-- pub fn with_namespace_hits(self, hits: Vec<NamespaceMemoryHit>) -> Self {- *self.namespace_hits.lock().unwrap() = hits;- self- }-- pub fn with_namespace_summaries(self, summaries: Vec<NamespaceSummary>) -> Self {- *self.namespace_summaries.lock().unwrap() = summaries;- self- }-- pub fn with_session_turns(self, turns: Vec<EpisodicTurn>) -> Self {- *self.session_turns.lock().unwrap() = turns;- self- }-- fn record(&self, call: Call) {- self.calls.lock().unwrap().push(call);- }-- pub fn calls(&self) -> Vec<Call> {- self.calls.lock().unwrap().clone()- }-- pub fn call_count(&self) -> usize {- self.calls.lock().unwrap().len()- }-- /// The single recorded call, panicking when there is not exactly one.- pub fn only_call(&self) -> Call {- let calls = self.calls();- assert_eq!(- calls.len(),- 1,- "expected exactly one driver call: {calls:?}"- );- calls.into_iter().next().unwrap()- }-}-/// A [`GuardPolicy`](super::GuardPolicy) over an embedded driver with default/// budgets — the shipped configuration.pub fn embedded_policy() -> super::GuardPolicy {diff --git a/src/openhuman/memory/guard/test_support_part_03.rs b/src/openhuman/memory/guard/test_support_part_03.rsindex 1f4304b907..43a6d867ad 100644--- a/src/openhuman/memory/guard/test_support_part_03.rs+++ b/src/openhuman/memory/guard/test_support_part_03.rs@@ -1,3 +1,86 @@+// `RecordingProvider`'s own constructor, seeders and call accessors. They+// live here rather than beside the struct in part 01 because that file is at+// the repo's 750-line ceiling for `src/openhuman` (scripts/ci/check-openhuman-+// rust-layout.mjs); the inherent impl is the one self-contained block that+// moves without splitting a trait implementation across files.++impl RecordingProvider {+ /// A provider with an empty call log and every seeded answer at its+ /// default — the shape most tests want before layering a `with_*` on top.+ pub fn new() -> Self {+ Self {+ calls: Mutex::new(Vec::new()),+ recall_result: Mutex::new(Vec::new()),+ fast_retrieve_result: Mutex::new(RetrievalResponse::default()),+ namespace_hits: Mutex::new(Vec::new()),+ namespace_summaries: Mutex::new(Vec::new()),+ session_turns: Mutex::new(Vec::new()),+ }+ }++ /// Seed what `recall` answers, so a budget test can drive a known set.+ pub fn with_recall_result(self, entries: Vec<MemoryEntry>) -> Self {+ *self.recall_result.lock().unwrap() = entries;+ self+ }++ /// Seed what `fast_retrieve` answers, so the auto-recall lane can run+ /// through a real guard with known hits.+ pub fn with_fast_retrieve_result(self, response: RetrievalResponse) -> Self {+ *self.fast_retrieve_result.lock().unwrap() = response;+ self+ }++ /// Seed what `recall_namespace_scored` answers, so the vector-floored+ /// paths can be driven with known scores.+ pub fn with_namespace_hits(self, hits: Vec<NamespaceMemoryHit>) -> Self {+ *self.namespace_hits.lock().unwrap() = hits;+ self+ }++ /// Seed what `namespaces` answers, so a namespace can look populated+ /// without a real store behind it.+ pub fn with_namespace_summaries(self, summaries: Vec<NamespaceSummary>) -> Self {+ *self.namespace_summaries.lock().unwrap() = summaries;+ self+ }++ /// Seed what `session_turns` answers. Without this the archivist's+ /// finalize path stops at its empty-entries early return and never+ /// reaches the recap it is being tested for.+ pub fn with_session_turns(self, turns: Vec<EpisodicTurn>) -> Self {+ *self.session_turns.lock().unwrap() = turns;+ self+ }++ /// Append one call to the log. Every family impl funnels through this.+ fn record(&self, call: Call) {+ self.calls.lock().unwrap().push(call);+ }++ /// Every call the driver saw, in order.+ pub fn calls(&self) -> Vec<Call> {+ self.calls.lock().unwrap().clone()+ }++ /// How many calls reached the driver — for tests that only care that a+ /// path was or was not taken.+ pub fn call_count(&self) -> usize {+ self.calls.lock().unwrap().len()+ }++ /// The single recorded call, panicking when there is not exactly one.+ pub fn only_call(&self) -> Call {+ let calls = self.calls();+ assert_eq!(+ calls.len(),+ 1,+ "expected exactly one driver call: {calls:?}"+ );+ calls.into_iter().next().unwrap()+ }+}+// Fixtures for the retrieval family's scored answers. Included into// `test_support.rs` after the provider parts, so the imports there are in scope.