Skip to content

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

test(memory): mirror Scoring in the guard and driver tables; one shared workspace for the driver-routed raw cases

Shanu83006fa5a7c3
diff --git a/.claude/memory.md b/.claude/memory.md
index 00b1a9b1a9..185673b018 100644
--- a/.claude/memory.md
+++ b/.claude/memory.md
@@ -263,6 +263,10 @@ Quick reference for anyone starting with Claude on this project. Updated by the
- **Testing a local TinyMemory module build** — use `TINYMEMORY_TEST_MODULE=<path/to/libtinymemory_module.dylib>` (the loader's dev override; CI uses it too), never `OPENHUMAN_MODULE_PATH`: that search path hands the module an empty config, it refuses setup (`workspace_dir must be set`) and tinybus reports it as an "unrecoverable fault" with the reason dropped. In the app log, module output is prefixed `tinybus_module <target> message=`; host output is not.
- **Module quarantine vs host cache** — the host's own engine copy caches its chunk-store handle; when the module quarantines `chunks.db`, `RuntimeCallbacks::publish_event` must reset it (`memory/host_impls.rs::reset_in_process_chunk_store`) or in-process reads stay `malformed` until restart.
- **Worktree submodules can be half-initialised** — a timed-out `git submodule update --init --recursive` leaves `vendor/<x>/` holding only a `.git` file while `git submodule status` shows a clean SHA. Detect with `ls vendor/<x>/Cargo.toml`; fix with `git submodule update --force --recursive <path>`. tinymemory has its own nested `vendor/tinycortex` that must be initialised from inside `vendor/tinymemory`.
+- **Bus-arity mismatches hide behind fakes** — the module sent `Embed(model, dims, texts)` while the host declares `(provider, model, dims, texts)`; both test fakes mirrored the wrong shape, so tests passed while every embed was refused at decode. A fake host in module tests must copy the real host signature; pin arity host-side the way `execute_takes_its_four_arguments…` does.
+- **`module_config` cloud defaults** — `cloud_embedding_model` is the module's *fallback* model (`DEFAULT_CLOUD_EMBEDDING_*`), never `config.memory.embedding_model` (the user's local model). Sync-family bus calls (`RunSourceSync`/`RunConnectionSync`/`BootstrapConnection`) need `SOURCE_SYNC_BUS_TIMEOUT`; the client default per-call RPC timeout is 30 s, so long RPCs pass `timeoutMs`.
+- **Raw-coverage tests that read through the driver need the boot policy** — `set_modules_policy` is first-call-wins and the module captures `workspace_dir` at load, so a module with several driver-routed cases needs ONE leaked shared workspace (`tests/json_rpc_e2e.rs` recipe): `config_path` beside it (`Config::default().config_path` is the dev's real `~/.openhuman/config.toml`), `embeddings_provider = none`, row-wipe (never the file) between counting cases, and registry entries persisted via `replace_sources_in` before a driver-run sync. The coverage script runs raw modules sorted and stops at the first red, so run the next ones locally first.
+- **Re-pin recipe (scripted)** — a new tinymemory release means: registry version/URL + 11 digests from `checksum.toml`, 4 workflow `memory_version`/`memory_sha256` pins, `ARTIFACT_CAPABILITIES_PIN`, gitlink to the tag, both `Cargo.lock`s, and a re-read of `Capability::ALL` (a new family needs the host accessor + forwarder in the same change, or the pin guards fail).
- **Never trust `cmd | tail` / `cmd | grep` exit codes in background checks** — the pipeline reports the filter's status, so a failed `cargo check` (disk full, missing submodule) read as green twice this session. Use `${PIPESTATUS[0]}` or grep for `Finished`.
- **Re-pinning the TinyMemory module moves five things in one commit** — gitlink → release tag commit, `modules/registry.rs` (version, release_url, 11 digests from the release's `checksum.toml`), the four workflow `memory_version`/`memory_sha256` pairs (ubuntu-22.04-x86_64 row), and `ARTIFACT_CAPABILITIES_PIN` in `modules/memory.rs` after diffing the capability surface between tags. Guards: `modules/memory_tests.rs` (workflow digests, capability pin). Run `cargo test --lib -- modules::memory modules::registry`. The version bump also dirties BOTH `Cargo.lock`s (root + `app/src-tauri`) and CI is `--locked`: `cargo metadata --locked --manifest-path <each>` then commit both.
- **Disk full (APFS) shows up as `could not compile syn` / `No space left on device`** — reclaim by deleting other checkouts' `target/` dirs (openhuman-1's shell target alone was 27 GB), never the active worktree's.
diff --git a/src/core/subsystem/driver_tests.rs b/src/core/subsystem/driver_tests.rs
index 066bf2b29c..98da381f6d 100644
--- a/src/core/subsystem/driver_tests.rs
+++ b/src/core/subsystem/driver_tests.rs
@@ -196,11 +196,11 @@ fn every_memory_contract_capability_string_maps_into_driver_capabilities() {
// A literal, so adding a family forces a look at this test rather than
// sliding past it. 13 → 17 when the port added People, Chunks, Retrieval
// and Profile, then 18 with Episodic, then 20 when tinymemory v1.7.0 added
- // SourceSync and CodingSessions. The assertion above is the load-bearing
- // one: it says the mapping is lossless, which is what makes the kernel's
- // opaque-string set able to carry the contract without knowing what a
- // memory capability is.
- assert_eq!(caps.len(), 20);
+ // SourceSync and CodingSessions, then 21 with v1.13.2 adding Scoring. The
+ // assertion above is the load-bearing one: it says the mapping is lossless,
+ // which is what makes the kernel's opaque-string set able to carry the
+ // contract without knowing what a memory capability is.
+ assert_eq!(caps.len(), 21);
assert!(
caps.contains("tool_memory"),
"the one non-identity snake_case family must survive"
diff --git a/src/openhuman/memory/guard/families.rs b/src/openhuman/memory/guard/families.rs
index 2394ad8dc0..38760f92ff 100644
--- a/src/openhuman/memory/guard/families.rs
+++ b/src/openhuman/memory/guard/families.rs
@@ -52,6 +52,7 @@ use crate::openhuman::memory::api::provider::retrieval::{
CoverWindowQuery, EntityMatch, FastRetrieveQuery, MemoryRetrieval, RetrievalHit,
RetrievalResponse, SourceRetrievalQuery,
};
+use crate::openhuman::memory::api::provider::scoring::MemoryScoring;
use crate::openhuman::memory::api::provider::sessions::{
CodingSessionIngestReport, CodingSessionIngestRequest, CodingSessionSource,
};
@@ -235,6 +236,13 @@ decorator!(
as_profile,
Profile
);
+decorator!(
+ /// Guarded [`MemoryScoring`].
+ GuardedScoring,
+ dyn MemoryScoring,
+ as_scoring,
+ Scoring
+);
// ── Ingest ───────────────────────────────────────────────────────────────────
@@ -1790,6 +1798,41 @@ impl MemorySourceSync for GuardedSourceSync {
}
}
+// ── Scoring ──────────────────────────────────────────────────────────────────
+
+#[async_trait]
+impl MemoryScoring for GuardedScoring {
+ async fn extract_entities(&self, query: &str) -> Result<Vec<String>, MemoryError> {
+ self.policy.admit_read(
+ Capability::Scoring,
+ "scoring.extract_entities",
+ NO_NAMESPACE,
+ true,
+ )?;
+ self.family()?.extract_entities(query).await
+ }
+
+ async fn embed_text(&self, text: &str) -> Result<Vec<f32>, MemoryError> {
+ self.policy.admit_read(
+ Capability::Scoring,
+ "scoring.embed_text",
+ NO_NAMESPACE,
+ true,
+ )?;
+ self.family()?.embed_text(text).await
+ }
+
+ async fn embedder_slug(&self) -> Result<String, MemoryError> {
+ self.policy.admit_read(
+ Capability::Scoring,
+ "scoring.embedder_slug",
+ NO_NAMESPACE,
+ false,
+ )?;
+ self.family()?.embedder_slug().await
+ }
+}
+
// ── Coding sessions ──────────────────────────────────────────────────────────
#[async_trait]
diff --git a/src/openhuman/memory/guard/mod.rs b/src/openhuman/memory/guard/mod.rs
index 19987ab8f0..7dc470b566 100644
--- a/src/openhuman/memory/guard/mod.rs
+++ b/src/openhuman/memory/guard/mod.rs
@@ -108,7 +108,7 @@ pub mod policy;
pub mod provider;
#[cfg(test)]
-mod test_support;
+pub(crate) mod test_support;
pub use policy::GuardPolicy;
pub use provider::MemoryGuard;
diff --git a/src/openhuman/memory/guard/provider.rs b/src/openhuman/memory/guard/provider.rs
index 974172d3aa..b8cd971de9 100644
--- a/src/openhuman/memory/guard/provider.rs
+++ b/src/openhuman/memory/guard/provider.rs
@@ -5,6 +5,7 @@ use std::sync::Arc;
use crate::openhuman::memory::api::capabilities::{Capabilities, Capability};
use crate::openhuman::memory::api::error::MemoryError;
use crate::openhuman::memory::api::health::MemoryHealth;
+use crate::openhuman::memory::api::provider::scoring::MemoryScoring;
use crate::openhuman::memory::api::provider::{
MemoryChunks, MemoryCodingSessions, MemoryDiff, MemoryDocuments, MemoryEntities,
MemoryEpisodic, MemoryGoals, MemoryGraph, MemoryIngest, MemoryMaintenance, MemoryPeople,
@@ -16,8 +17,8 @@ use async_trait::async_trait;
use super::families::{
GuardedChunks, GuardedCodingSessions, GuardedDiff, GuardedDocuments, GuardedEntities,
GuardedEpisodic, GuardedGoals, GuardedGraph, GuardedIngest, GuardedMaintenance, GuardedPeople,
- GuardedProfile, GuardedRetrieval, GuardedSourceSync, GuardedSources, GuardedToolMemory,
- GuardedTree,
+ GuardedProfile, GuardedRetrieval, GuardedScoring, GuardedSourceSync, GuardedSources,
+ GuardedToolMemory, GuardedTree,
};
use super::policy::GuardPolicy;
@@ -55,6 +56,7 @@ pub struct MemoryGuard {
episodic: Option<GuardedEpisodic>,
source_sync: Option<GuardedSourceSync>,
coding_sessions: Option<GuardedCodingSessions>,
+ scoring: Option<GuardedScoring>,
}
impl MemoryGuard {
@@ -89,6 +91,7 @@ impl MemoryGuard {
episodic: family!(Episodic, GuardedEpisodic),
source_sync: family!(SourceSync, GuardedSourceSync),
coding_sessions: family!(CodingSessions, GuardedCodingSessions),
+ scoring: family!(Scoring, GuardedScoring),
inner,
policy,
}
@@ -205,6 +208,9 @@ impl MemoryProvider for MemoryGuard {
.as_ref()
.map(|g| g as &dyn MemoryCodingSessions)
}
+ fn as_scoring(&self) -> Option<&dyn MemoryScoring> {
+ self.scoring.as_ref().map(|g| g as &dyn MemoryScoring)
+ }
}
#[cfg(test)]
diff --git a/src/openhuman/memory/guard/test_support.rs b/src/openhuman/memory/guard/test_support.rs
index d853551083..a19dca005a 100644
--- a/src/openhuman/memory/guard/test_support.rs
+++ b/src/openhuman/memory/guard/test_support.rs
@@ -32,9 +32,9 @@ use crate::openhuman::memory::api::provider::{
EpisodicEvent, FacetType, FastRetrieveQuery, MemoryChunks, MemoryCodingSessions, MemoryCore,
MemoryDiff, MemoryDocuments, MemoryEntities, MemoryEpisodic, MemoryGoals, MemoryGraph,
MemoryIngest, MemoryMaintenance, MemoryPeople, MemoryPortability, MemoryProfile,
- MemoryProvider, MemoryRecall, MemoryRetrieval, MemorySourceSink, MemorySourceSync,
- MemoryToolMemory, MemoryTree, PersonHandle, PersonInteraction, PersonRecord, PersonScore,
- ProfileFacet, RankedPerson, ResolvedPerson, RetrievalHit, RetrievalResponse,
+ MemoryProvider, MemoryRecall, MemoryRetrieval, MemoryScoring, MemorySourceSink,
+ MemorySourceSync, MemoryToolMemory, MemoryTree, PersonHandle, PersonInteraction, PersonRecord,
+ PersonScore, ProfileFacet, RankedPerson, ResolvedPerson, RetrievalHit, RetrievalResponse,
SourceRetrievalQuery, UserState,
};
use crate::openhuman::memory::api::recall::OwnedRecallOpts;
@@ -740,6 +740,9 @@ impl MemoryProvider for RecordingProvider {
fn as_coding_sessions(&self) -> Option<&dyn MemoryCodingSessions> {
Some(self)
}
+ fn as_scoring(&self) -> Option<&dyn MemoryScoring> {
+ Some(self)
+ }
}
// The two families tinymemory v1.7.0 added. `capabilities()` above answers
@@ -1188,3 +1191,31 @@ impl MemoryPeople for RecordingProvider {
Ok(AddressBookSeedOutcome::default())
}
}
+
+#[async_trait]
+impl MemoryScoring for RecordingProvider {
+ async fn extract_entities(&self, query: &str) -> Result<Vec<String>, MemoryError> {
+ self.record(Call {
+ method: "scoring.extract_entities".into(),
+ content: Some(query.to_string()),
+ taint: None,
+ scoped: None,
+ });
+ Ok(Vec::new())
+ }
+
+ async fn embed_text(&self, text: &str) -> Result<Vec<f32>, MemoryError> {
+ self.record(Call {
+ method: "scoring.embed_text".into(),
+ content: Some(text.to_string()),
+ taint: None,
+ scoped: None,
+ });
+ Ok(Vec::new())
+ }
+
+ async fn embedder_slug(&self) -> Result<String, MemoryError> {
+ self.record(Call::plain("scoring.embedder_slug"));
+ Ok(String::new())
+ }
+}
diff --git a/src/openhuman/memory/ops/provider.rs b/src/openhuman/memory/ops/provider.rs
index 1e35dff9d9..6032a48bf1 100644
--- a/src/openhuman/memory/ops/provider.rs
+++ b/src/openhuman/memory/ops/provider.rs
@@ -211,6 +211,10 @@ mod tests {
"profile",
"recall",
"retrieval",
+ // Added with tinymemory v1.13.0: the MemoryScoring bus family
+ // (#5560). Widened deliberately — the wire surface the frontend
+ // reads must be an explicit decision, not a silent addition.
+ "scoring",
"source_sync",
"sources",
"tool_memory",
diff --git a/src/openhuman/memory/sources/rpc.rs b/src/openhuman/memory/sources/rpc.rs
index b693b3a148..9d3bacf182 100644
--- a/src/openhuman/memory/sources/rpc.rs
+++ b/src/openhuman/memory/sources/rpc.rs
@@ -577,6 +577,16 @@ pub async fn sync_rpc(req: SyncRequest) -> Result<RpcOutcome<SyncResponse>, Stri
binding.driver_id()
)
})?;
+ // The enabled gate is not the driver's. `run_source_sync` runs whatever id
+ // it is handed; it is `sources::sync::sync_source` and the periodic loop
+ // that refuse a disabled entry, and this RPC is the third caller, the one
+ // behind the user's Sync button. Same words as `sync_source` so the UI
+ // reads one message (#5820).
+ if let Some(entry) = super::registry::get_source_in(&config, &req.source_id)? {
+ if !entry.enabled {
+ return Err(format!("source '{}' is disabled", entry.id));
+ }
+ }
sync.run_source_sync(&req.source_id)
.await
.map_err(|error| error.to_string())?;
diff --git a/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs b/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
index d81b65e093..152d833dea 100644
--- a/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_threads_raw_coverage_e2e.rs
@@ -13,7 +13,7 @@ use chrono::{TimeZone, Utc};
use serde_json::json;
use serde_json::{Map, Value};
use std::ffi::OsString;
-use std::path::Path;
+use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex, OnceLock};
use tempfile::TempDir;
@@ -242,6 +242,95 @@ fn config_in(tmp: &TempDir) -> Config {
config
}
+/// The one memory workspace every driver-routed case in this module shares.
+///
+/// The module host captures a workspace **once per process**: the boot policy
+/// is first-call-wins and the loaded artifact takes its `workspace_dir` at load,
+/// while each case here used to get its own `TempDir`. Whichever case published
+/// first bound the module to a directory that was deleted when that case
+/// returned, and every later read through the driver answered from the dead
+/// store: 0 rows where the case had just seeded 1. Production never has that
+/// mismatch, because boot publishes the runtime config and module and handlers
+/// name one object. This reproduces that arrangement the way
+/// `tests/json_rpc_e2e.rs` does: one leaked directory, the policy published from
+/// it exactly once, and every driver-routed case pointing its config (and
+/// `OPENHUMAN_WORKSPACE`) here. Cases keep their own `TempDir` for the files they
+/// write; only the memory workspace is shared. The path ends in `workspace` so
+/// `resolve_config_dir_for_workspace` treats it as the workspace itself rather
+/// than appending another segment, and the env var and the config agree exactly.
+fn module_workspace() -> &'static Path {
+ static WORKSPACE: OnceLock<PathBuf> = OnceLock::new();
+ WORKSPACE.get_or_init(|| {
+ let dir = TempDir::new().expect("module workspace tempdir");
+ let path = dir.path().join("workspace");
+ std::fs::create_dir_all(&path).expect("create module workspace");
+ // Leaked on purpose: the module keeps this path for the process lifetime.
+ std::mem::forget(dir);
+ ensure_memory_seams();
+ #[cfg(feature = "modules")]
+ openhuman_core::openhuman::modules::memory::set_modules_policy(Arc::new(shared_config_at(
+ &path,
+ )));
+ path
+ })
+}
+
+/// A config whose memory workspace **and** source registry are the shared ones.
+///
+/// `config_path` matters as much as `workspace_dir`: the module reads its
+/// source registry from the file the host names there, and `Config::default()`
+/// names the developer's real `~/.openhuman/config.toml`. Pointing it beside
+/// the shared workspace is also where `Config::load_or_init` resolves it from
+/// `OPENHUMAN_WORKSPACE`, so env-driven cases and config-driven cases write and
+/// read one registry. Embeddings are off so no case asks the host to embed.
+fn shared_config_at(workspace: &Path) -> Config {
+ let mut config = Config::default();
+ config.workspace_dir = workspace.to_path_buf();
+ config.config_path = workspace
+ .parent()
+ .expect("shared workspace has a parent")
+ .join("config.toml");
+ config.embeddings_provider = Some("none".into());
+ config
+}
+
+/// Point `config` at the shared module workspace and registry.
+fn use_module_workspace(config: &mut Config) {
+ let shared = shared_config_at(module_workspace());
+ config.workspace_dir = shared.workspace_dir;
+ config.config_path = shared.config_path;
+ config.embeddings_provider = shared.embeddings_provider;
+}
+
+/// Empty the shared chunk store so a case that counts rows sees only its own.
+///
+/// Rows, not the file: the module holds its connection open, so replacing the
+/// file would leave it reading the old inode. Tables a fresh store lacks are
+/// skipped rather than failed.
+fn wipe_shared_store(config: &Config) {
+ with_connection(config, |conn| {
+ for table in [
+ "mem_tree_chunk_embeddings",
+ "mem_tree_chunk_reembed_skipped",
+ "mem_tree_entity_edges",
+ "mem_tree_entity_hotness",
+ "mem_tree_entity_index",
+ "mem_tree_score",
+ "mem_tree_ingested_sources",
+ "mem_tree_summary_embeddings",
+ "mem_tree_summaries",
+ "mem_tree_chunks",
+ ] {
+ if let Err(error) = conn.execute(&format!("DELETE FROM {table}"), []) {
+ let text = error.to_string();
+ assert!(text.contains("no such table"), "wipe {table}: {text}");
+ }
+ }
+ Ok(())
+ })
+ .expect("wipe shared store");
+}
+
fn source(kind: SourceKind, id: &str) -> MemorySourceEntry {
MemorySourceEntry {
id: id.to_string(),
@@ -767,8 +856,9 @@ async fn memory_source_status_counts_reader_and_composio_prefixes() {
async fn memory_thread_tree_and_sync_controller_schemas_execute_public_handlers() {
let _lock = env_lock();
let tmp = TempDir::new().expect("tempdir");
- let _workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", tmp.path());
+ let _workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", module_workspace());
let config = Config::load_or_init().await.expect("init isolated config");
+ wipe_shared_store(&config);
let thread_schemas = all_threads_controller_schemas();
let thread_controllers = all_threads_registered_controllers();
@@ -1747,8 +1837,8 @@ fn memory_tree_runtime_store_buffers_and_retrieval_wire_helpers() {
async fn memory_read_rpc_score_index_and_summary_helpers_cover_dashboard_paths() {
let tmp = TempDir::new().expect("tempdir");
let mut config = config_in(&tmp);
- config.config_path = tmp.path().join("config.toml");
- config.embeddings_provider = Some("none".into());
+ use_module_workspace(&mut config);
+ wipe_shared_store(&config);
let now = Utc.with_ymd_and_hms(2026, 5, 29, 14, 0, 0).unwrap();
let mut gmail = chunk(
@@ -1769,11 +1859,18 @@ async fn memory_read_rpc_score_index_and_summary_helpers_cover_dashboard_paths()
slack.metadata.source_kind = ChunkSourceKind::Chat;
slack.metadata.tags = vec!["reply".into(), "provider:slack".into()];
upsert_chunks(&config, &[gmail.clone(), slack.clone()]).expect("upsert read rpc chunks");
+ // `has_embedding` is a row in the embeddings table, not the legacy column.
with_connection(&config, |conn| {
conn.execute(
- "UPDATE mem_tree_chunks SET embedding = X'00010203', tags_json = ?2 WHERE id = ?1",
+ "UPDATE mem_tree_chunks SET tags_json = ?2 WHERE id = ?1",
(&gmail.id, json!(["sent", "provider:gmail"]).to_string()),
)?;
+ conn.execute(
+ "INSERT INTO mem_tree_chunk_embeddings \
+ (chunk_id, model_signature, vector, dim, created_at) \
+ VALUES (?1, 'test-sig', X'00010203', 1, 0.0)",
+ [&gmail.id],
+ )?;
Ok(())
})
.expect("mark embedded and tags");
@@ -2630,7 +2727,14 @@ async fn memory_queue_and_tool_memory_public_stores_cover_persistence_edges() {
async fn memory_source_sync_entrypoint_rejects_disabled_and_ingests_folder_items() {
let _lock = env_lock();
let tmp = TempDir::new().expect("tempdir");
- let config = config_in(&tmp);
+ let _env_workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", module_workspace());
+ let mut config = config_in(&tmp);
+ use_module_workspace(&mut config);
+ wipe_shared_store(&config);
+ // Folder kinds run in-process through `run_source_pipeline_core`, which
+ // takes its memory client from the process global; bind that to the shared
+ // workspace too, or the rows land wherever an earlier case left it.
+ tinymemory_core::global::init(config.workspace_dir.clone()).expect("bind global memory client");
std::fs::write(
tmp.path().join("sync-note.md"),
"# Sync note\n\nAlice documents deterministic source sync coverage.",
@@ -2640,6 +2744,9 @@ async fn memory_source_sync_entrypoint_rejects_disabled_and_ingests_folder_items
let mut disabled = source(SourceKind::Folder, "src_disabled");
disabled.path = Some(tmp.path().to_string_lossy().to_string());
disabled.enabled = false;
+ let disabled_entry = disabled.clone();
+ tinymemory_core::sources::registry::replace_sources_in(&config, &[disabled_entry.clone()])
+ .expect("register the disabled source the driver will look up");
assert!(sync_source(disabled, Arc::new(config.clone()))
.await
.unwrap_err()
@@ -2648,6 +2755,13 @@ async fn memory_source_sync_entrypoint_rejects_disabled_and_ingests_folder_items
let mut folder = source(SourceKind::Folder, "src_sync");
folder.path = Some(tmp.path().to_string_lossy().to_string());
folder.glob = Some("sync-note.md".into());
+ // The sync runs inside the bound driver, which resolves the source by id
+ // from the shared registry rather than from the entry handed in here.
+ tinymemory_core::sources::registry::replace_sources_in(
+ &config,
+ &[disabled_entry, folder.clone()],
+ )
+ .expect("register the sources the driver will look up");
sync_source(folder, Arc::new(config.clone()))
.await
.expect("queue folder sync");
@@ -2668,9 +2782,15 @@ async fn memory_source_sync_entrypoint_rejects_disabled_and_ingests_folder_items
}
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
}
+ let seen: Vec<String> = with_connection(&config, |conn| {
+ let mut stmt = conn.prepare("SELECT DISTINCT source_id FROM mem_tree_chunks")?;
+ let rows = stmt.query_map([], |row| row.get::<_, String>(0))?;
+ Ok(rows.collect::<Result<Vec<_>, _>>()?)
+ })
+ .expect("list source ids");
assert!(
synced_rows > 0,
- "folder sync should ingest at least one chunk"
+ "folder sync should ingest at least one chunk; store holds source_ids={seen:?}"
);
let mut twitter = source(SourceKind::TwitterQuery, "src_twitter_sync");
@@ -3796,8 +3916,9 @@ async fn threads_title_generation_branches_cover_noop_and_not_found_paths() {
async fn memory_sources_registry_rpc_and_schema_handlers_cover_crud_edges() {
let _lock = env_lock();
let tmp = TempDir::new().expect("tempdir");
- let _workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", tmp.path());
- Config::load_or_init().await.expect("init isolated config");
+ let _workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", module_workspace());
+ let config = Config::load_or_init().await.expect("init isolated config");
+ wipe_shared_store(&config);
std::fs::write(tmp.path().join("reader-note.md"), "# Reader note").expect("write note");
let schemas = all_memory_sources_controller_schemas();
@@ -4020,13 +4141,7 @@ async fn memory_ops_public_handlers_cover_document_file_kv_graph_and_envelopes_b
let _lock = env_lock();
ensure_memory_seams();
let tmp = TempDir::new().expect("tempdir");
- let _workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", tmp.path());
- #[cfg(feature = "modules")]
- {
- let mut config = Config::default();
- config.workspace_dir = tmp.path().to_path_buf();
- openhuman_core::openhuman::modules::memory::set_modules_policy(Arc::new(config));
- }
+ let _workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", module_workspace());
let init = openhuman_core::openhuman::memory::ops::memory_init(MemoryInitRequest {
jwt_token: Some("ignored-token".into()),
@@ -4520,15 +4635,10 @@ async fn memory_tree_retrieval_rpc_and_schema_wrappers_cover_empty_and_invalid_p
pinned artifact predates RetrieveSource"]
async fn memory_query_backend_and_tree_flush_wrappers_cover_public_edges() {
let _lock = env_lock();
- // The query tools resolve a bound memory driver, and binding one needs the
- // module policy an integration test never boots. Publishing it here is
- // safe: each raw-coverage module runs in its own process.
- #[cfg(feature = "modules")]
- openhuman_core::openhuman::modules::memory::set_modules_policy(std::sync::Arc::new(
- Config::default(),
- ));
+ // The query tools resolve a bound memory driver; `module_workspace` is
+ // where that driver lives for this whole process.
let tmp = TempDir::new().expect("tempdir");
- let _workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", tmp.path());
+ let _workspace = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", module_workspace());
let mut config = Config::load_or_init().await.expect("init isolated config");
config.memory_tree.embedding_endpoint = None;
config.memory_tree.embedding_model = None;