Skip to content

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

test(storage): link the SQLite driver into lib tests so default-feature test builds compile

M3gA-Mindeb5c422f9a03
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index 5302e7ee14..afaa9e9eff 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -481,6 +481,10 @@ windows-sys = { version = "0.61", features = [
tokio-tungstenite = { version = "0.29", default-features = false, features = ["connect", "handshake", "rustls-tls-webpki-roots"] }
[dev-dependencies]
+# Lib tests always link the SQLite driver, so the durable-storage test helpers
+# (`storage::test_support::sqlite_backend`, persistent workspace defaults)
+# compile under the default (contributor) feature set too.
+tinystoragedrivers = { git = "https://github.com/tinyhumansai/tinystoragedrivers", rev = "f05fbd230c2c403c8dcdef57316fa55265379039", default-features = false, features = ["sqlite"] }
tinystoragedrivers-testkit = { git = "https://github.com/tinyhumansai/tinystoragedrivers", rev = "f05fbd230c2c403c8dcdef57316fa55265379039" }
tinyagents-session = { path = "../../vendor/tinyagents/crates/tinyagents-session", features = ["storage-drivers", "testkit"] }
# Legacy TinyChannels provider/runtime fixtures remain available to tests only;
diff --git a/crates/openhuman-core/src/profiles/host_tests.rs b/crates/openhuman-core/src/profiles/host_tests.rs
index dbb33098b5..9795901aad 100644
--- a/crates/openhuman-core/src/profiles/host_tests.rs
+++ b/crates/openhuman-core/src/profiles/host_tests.rs
@@ -512,7 +512,7 @@ async fn a_clean_reopen_does_not_recover_but_a_takeover_does() {
.as_ref()
.expect("test host has shared storage");
let cluster = backend
- .for_scope(&Scope::new(crate::storage::lease::CLUSTER_SCOPE).unwrap())
+ .for_scope(&crate::storage::Scope::new(crate::storage::lease::CLUSTER_SCOPE).unwrap())
.unwrap();
let lease_id = tinystoragedrivers::Key::new(format!(
"{}/{}",
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rs
index 4a27b3f4cc..d84bbc68ad 100644
--- a/crates/openhuman-core/src/storage/local.rs
+++ b/crates/openhuman-core/src/storage/local.rs
@@ -54,11 +54,11 @@ type WorkspaceBackend = Arc<tokio::sync::OnceCell<Arc<dyn StorageBackend>>>;
static WORKSPACES: LazyLock<Mutex<HashMap<PathBuf, WorkspaceBackend>>> =
LazyLock::new(Mutex::default);
-#[cfg(all(test, feature = "storage-sqlite"))]
+#[cfg(test)]
static TEST_WORKSPACE_URLS: LazyLock<Mutex<HashMap<PathBuf, String>>> =
LazyLock::new(Mutex::default);
-#[cfg(all(test, feature = "storage-sqlite"))]
+#[cfg(test)]
pub(crate) fn use_persistent_default_for_test(workspace_dir: &Path) {
TEST_WORKSPACE_URLS
.lock()
@@ -165,7 +165,7 @@ async fn open_default_backend(_workspace_dir: PathBuf) -> Result<Arc<dyn Storage
#[cfg(test)]
await_test_backend_open_gate().await;
- #[cfg(all(test, feature = "storage-sqlite"))]
+ #[cfg(test)]
{
let persistent_url = TEST_WORKSPACE_URLS
.lock()
diff --git a/crates/openhuman-core/src/storage/test_support.rs b/crates/openhuman-core/src/storage/test_support.rs
index 136d05ef52..c6765b6951 100644
--- a/crates/openhuman-core/src/storage/test_support.rs
+++ b/crates/openhuman-core/src/storage/test_support.rs
@@ -3,7 +3,6 @@
use std::path::PathBuf;
use std::sync::{Arc, Mutex, MutexGuard, OnceLock};
-#[cfg(feature = "storage-sqlite")]
use crate::storage::block_on_anyhow;
use crate::storage::StorageBackend;
@@ -132,7 +131,6 @@ impl Drop for InstalledBackendGuard {
/// as the fixture is retained. Use it for persistence, conditional-write,
/// fence, and import-claim tests; the TSD memory backend does not emulate those
/// capabilities.
-#[cfg(feature = "storage-sqlite")]
pub struct SqliteBackend {
_directory: tempfile::TempDir,
/// The actual SQLite backend opened from [`Self::url`].
@@ -143,7 +141,6 @@ pub struct SqliteBackend {
/// Opens an isolated on-disk SQLite backend for tests that need its real
/// cross-process conditions or durable state.
-#[cfg(feature = "storage-sqlite")]
pub fn sqlite_backend() -> anyhow::Result<SqliteBackend> {
let directory = tempfile::tempdir()?;
let url = format!("sqlite:{}", directory.path().join("storage").display());
@@ -152,7 +149,6 @@ pub fn sqlite_backend() -> anyhow::Result<SqliteBackend> {
/// Opens a SQLite backend at `url`, retaining `directory` for the lifetime of
/// the returned backend fixture.
-#[cfg(feature = "storage-sqlite")]
pub fn sqlite_backend_in(
directory: tempfile::TempDir,
url: impl Into<String>,