Skip to content

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

test(sessions): add conditioned storage factory to splice fixture

Steven Enamakel806333e12e29
diff --git a/crates/openhuman-core/src/storage/sessions/splice_fixture_tests.rs b/crates/openhuman-core/src/storage/sessions/splice_fixture_tests.rs
index 5c69456263..e3e9d8faea 100644
--- a/crates/openhuman-core/src/storage/sessions/splice_fixture_tests.rs
+++ b/crates/openhuman-core/src/storage/sessions/splice_fixture_tests.rs
@@ -2,7 +2,9 @@
use std::sync::Arc;
-use tinyagents_session::port::{AgentStorageFactory, DriverSessionStores, SessionStoreProvider};
+use tinyagents_session::port::{
+ AgentStorageFactory, ConditionedAgentStorageFactory, DriverSessionStores, SessionStoreProvider,
+};
use tinyagents_session::transcript::{TranscriptLocator, TranscriptMessage, TranscriptMeta};
/// A fresh transcript store over the driver ports on memory (the production
@@ -15,14 +17,28 @@ pub(crate) fn memory_locator() -> Arc<dyn TranscriptLocator> {
/// agent IDs share this fixture's isolated scope so legacy transcript grouping
/// can be exercised without weakening production scope selection.
pub(crate) fn memory_session_provider() -> Arc<dyn SessionStoreProvider> {
- let backend = crate::storage::test_support::memory_backend();
+ // The unfenced memory backend opens conditioned scopes too, which the
+ // lease-conditioned generation writes require.
+ let backend: Arc<dyn crate::storage::StorageBackend> =
+ Arc::new(crate::storage::test_support::UnfencedMemoryBackend::new());
+ let plain = Arc::clone(&backend);
let factory: AgentStorageFactory = Arc::new(move |_| {
let scope = tinystoragedrivers_types::Scope::new("transcript-fixture")
.expect("valid fixture scope");
- let storage = backend.for_scope(&scope)?;
+ let storage = plain.for_scope(&scope)?;
Ok(tinyagents_storage_kit::ScopedStorage::new(storage, scope))
});
- Arc::new(DriverSessionStores::new(factory).expect("driver session stores over testkit memory"))
+ let conditioned: ConditionedAgentStorageFactory = Arc::new(move |_, condition| {
+ let scope = tinystoragedrivers_types::Scope::new("transcript-fixture")
+ .expect("valid fixture scope");
+ let storage = backend.for_scope_conditioned(&scope, condition)?;
+ Ok(tinyagents_storage_kit::ScopedStorage::new(storage, scope))
+ });
+ Arc::new(
+ DriverSessionStores::new(factory)
+ .expect("driver session stores over testkit memory")
+ .with_conditioned_storage_factory(conditioned),
+ )
}
/// A thread's head transcript as the model reads it.