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
fix: correct test module paths for memory sources
Steven Enamakelca70b830ba44
diff --git a/crates/openhuman-core/src/memory/sources/composio_tests.rs b/crates/openhuman-core/src/memory/sources/composio_tests.rsindex 4563e55b7b..b498ae8ab1 100644--- a/crates/openhuman-core/src/memory/sources/composio_tests.rs+++ b/crates/openhuman-core/src/memory/sources/composio_tests.rs@@ -1 +1,157 @@use super::*;+use crate::config::schema::MemorySourceKind;+use crate::memory::test_fixtures::{bind_reference, config_in, stored};+use tinymemory::{ItemKind, MetaFilter};++fn record(id: &str, title: &str, content: &str) -> ConnectorRecord {+ ConnectorRecord {+ item_id: id.to_string(),+ title: title.to_string(),+ content: content.to_string(),+ ..ConnectorRecord::default()+ }+}++#[test]+fn record_item_builds_a_tagged_document() {+ let mut rec = record("m-1", " Quarterly plan ", "ship memory v2");+ rec.mime = Some("text/plain".into());+ rec.url = Some("https://mail.example/m-1".into());+ rec.updated_at_ms = Some(1_700_000_000_000);+ rec.tags = vec!["inbox".into(), " ".into(), "gmail".into(), "inbox".into()];++ let item = record_item("GMail", "conn-7", "src-g", &rec).expect("an item");+ let StoreItem::Document { title, body, mime, meta } = item else {+ panic!("expected a document");+ };+ assert_eq!(title.as_deref(), Some("Quarterly plan"));+ assert!(matches!(body, DocumentBody::Text(ref t) if t == "ship memory v2"));+ assert_eq!(mime.as_deref(), Some("text/plain"));+ assert_eq!(meta.url.as_deref(), Some("https://mail.example/m-1"));+ assert_eq!(meta.source.kind, SourceKind::Composio);+ assert_eq!(meta.source.id.as_deref(), Some("src-g"));+ assert_eq!(+ meta.tags,+ vec!["gmail".to_string(), "connection:conn-7".to_string(), "inbox".to_string()],+ "toolkit and connection first, blanks and duplicates dropped"+ );+ assert_eq!(meta.observed_at.map(|t| t.timestamp_millis()), Some(1_700_000_000_000));+}++#[test]+fn record_item_skips_empty_content_and_blank_titles() {+ assert!(record_item("gmail", "c", "s", &record("1", "t", " ")).is_none());+ let StoreItem::Document { title, .. } =+ record_item("gmail", "c", "s", &record("1", " ", "body")).unwrap()+ else {+ panic!("expected a document");+ };+ assert!(title.is_none());+}++#[test]+fn connection_tag_is_namespaced() {+ assert_eq!(connection_tag("abc"), "connection:abc");+}++#[tokio::test]+async fn store_records_stores_the_non_empty_ones() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ let engine = bind_reference(&config);+ let bound = crate::memory::engine::resolve(&config).engine().unwrap();+ let records = vec![+ record("1", "One", "first record"),+ record("2", "Empty", " "),+ record("3", "Three", "third record"),+ ];+ let stored_count = store_records(&bound, "notion", "conn-1", "src-n", &records)+ .await+ .unwrap();+ assert_eq!(stored_count, 2);+ let docs = stored(+ &engine,+ MetaFilter {+ kinds: vec![ItemKind::Document],+ ..MetaFilter::default()+ },+ )+ .await;+ assert_eq!(docs.len(), 2);+ assert!(docs+ .iter()+ .all(|d| d.meta.source.kind == SourceKind::Composio));+}++#[tokio::test]+async fn store_records_with_nothing_to_store_is_zero() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ bind_reference(&config);+ let bound = crate::memory::engine::resolve(&config).engine().unwrap();+ assert_eq!(store_records(&bound, "notion", "c", "s", &[]).await.unwrap(), 0);+}++#[test]+fn source_id_for_toolkit_prefers_the_configured_source() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = config_in(&tmp);+ assert_eq!(source_id_for_toolkit(&config, "Gmail"), "composio:gmail");+ config.memory.sources.push(crate::config::schema::MemorySourceConfig {+ id: "src-gmail".into(),+ kind: MemorySourceKind::Composio,+ target: "gmail".into(),+ label: "Gmail".into(),+ schedule_mins: None,+ });+ config.memory.sources.push(crate::config::schema::MemorySourceConfig {+ id: "src-folder".into(),+ kind: MemorySourceKind::Folder,+ target: "notion".into(),+ label: "Folder named like a toolkit".into(),+ schedule_mins: None,+ });+ assert_eq!(source_id_for_toolkit(&config, "GMAIL"), "src-gmail");+ assert_eq!(source_id_for_toolkit(&config, "notion"), "composio:notion");+}++#[tokio::test]+async fn forget_connection_removes_only_that_connections_items() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ let engine = bind_reference(&config);+ let bound = crate::memory::engine::resolve(&config).engine().unwrap();+ store_records(&bound, "gmail", "conn-a", "src", &[record("1", "A", "from a")])+ .await+ .unwrap();+ store_records(&bound, "gmail", "conn-b", "src", &[record("2", "B", "from b")])+ .await+ .unwrap();+ assert_eq!(forget_connection(&config, "conn-a").await.unwrap(), 1);+ let left = stored(&engine, MetaFilter::default()).await;+ assert_eq!(left.len(), 1);+ assert!(left[0].meta.tags.contains(&"connection:conn-b".to_string()));+}++#[tokio::test]+async fn forget_connection_with_memory_off_forgets_nothing() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ assert_eq!(forget_connection(&config, "conn-a").await.unwrap(), 0);+}++#[tokio::test]+async fn sync_toolkit_without_a_connector_is_an_error_not_a_panic() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ bind_reference(&config);+ let bound = crate::memory::engine::resolve(&config).engine().unwrap();+ let source = crate::config::schema::MemorySourceConfig {+ id: "src-gmail".into(),+ kind: MemorySourceKind::Composio,+ target: "gmail".into(),+ label: "Gmail".into(),+ schedule_mins: None,+ };+ assert!(sync_toolkit(&config, &bound, &source).await.is_err());+}diff --git a/crates/openhuman-core/src/memory/sources/mod_tests.rs b/crates/openhuman-core/src/memory/sources/mod_tests.rsindex 4563e55b7b..2909169f26 100644--- a/crates/openhuman-core/src/memory/sources/mod_tests.rs+++ b/crates/openhuman-core/src/memory/sources/mod_tests.rs@@ -1 +1,232 @@use super::*;+use crate::memory::error::INVALID_REQUEST;+use crate::memory::test_fixtures::{bind_reference, config_in, stored};+use chrono::Duration;+use tinymemory::{DocumentBody, MemoryMeta, SourceKind, SourceRef, StoreItem};++fn add_params(kind: &str, target: &str) -> SourcesAddParams {+ SourcesAddParams {+ kind: kind.to_string(),+ target: target.to_string(),+ label: None,+ schedule_mins: None,+ }+}++fn source(id: &str, mins: Option<u32>) -> MemorySourceConfig {+ MemorySourceConfig {+ id: id.to_string(),+ kind: MemorySourceKind::Folder,+ target: "/tmp/x".to_string(),+ label: id.to_string(),+ schedule_mins: mins,+ }+}++#[test]+fn normalize_target_accepts_each_kinds_shape() {+ assert_eq!(+ normalize_target(MemorySourceKind::Folder, " /home/me/notes ").unwrap(),+ "/home/me/notes"+ );+ assert_eq!(+ normalize_target(MemorySourceKind::File, "notes.md").unwrap(),+ "notes.md"+ );+ assert_eq!(+ normalize_target(MemorySourceKind::Github, "owner/repo").unwrap(),+ "https://github.com/owner/repo"+ );+ assert_eq!(+ normalize_target(MemorySourceKind::Github, "https://github.com/o/r").unwrap(),+ "https://github.com/o/r"+ );+ assert_eq!(+ normalize_target(MemorySourceKind::Rss, "https://example.com/feed.xml").unwrap(),+ "https://example.com/feed.xml"+ );+ assert_eq!(+ normalize_target(MemorySourceKind::Link, "https://example.com").unwrap(),+ "https://example.com/"+ );+ assert_eq!(+ normalize_target(MemorySourceKind::Composio, "GMail").unwrap(),+ "gmail"+ );+}++#[test]+fn normalize_target_rejects_malformed_targets() {+ for (kind, target) in [+ (MemorySourceKind::Folder, " "),+ (MemorySourceKind::Github, "just-one-part"),+ (MemorySourceKind::Github, "a/b/c"),+ (MemorySourceKind::Github, "/repo"),+ (MemorySourceKind::Link, "not a url"),+ (MemorySourceKind::Link, "ftp://example.com/x"),+ (MemorySourceKind::Rss, "file:///etc/passwd"),+ (MemorySourceKind::Composio, "has space"),+ (MemorySourceKind::Composio, "a/b"),+ ] {+ assert_eq!(+ normalize_target(kind, target).unwrap_err().code(),+ INVALID_REQUEST,+ "{kind:?} {target}"+ );+ }+}++#[test]+fn add_list_and_remove_round_trip_through_config() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = config_in(&tmp);++ let added = apply_add(+ &mut config,+ &SourcesAddParams {+ label: Some(" My notes ".into()),+ schedule_mins: Some(60),+ ..add_params("Folder", "/home/me/notes")+ },+ )+ .unwrap();+ assert!(added.id.starts_with("src-"));+ assert_eq!(added.kind, MemorySourceKind::Folder);+ assert_eq!(added.label, "My notes");+ assert_eq!(added.schedule_mins, Some(60));++ let unlabeled = apply_add(&mut config, &add_params("github", "owner/repo")).unwrap();+ assert_eq!(unlabeled.label, "https://github.com/owner/repo", "label defaults to the target");++ let listed = list(&config);+ assert_eq!(listed.len(), 2);+ assert_eq!(listed[0].id, added.id);+ assert_eq!(listed[0].status, SourceStatus::Idle);+ assert_eq!(listed[0].items, 0);+ assert!(listed[0].last_sync_at.is_none());++ // The same kind and target cannot be added twice.+ let duplicate = apply_add(&mut config, &add_params("folder", "/home/me/notes")).unwrap_err();+ assert_eq!(duplicate.code(), INVALID_REQUEST);++ let removed = apply_remove(&mut config, &added.id).expect("removed");+ assert_eq!(removed.id, added.id);+ assert_eq!(list(&config).len(), 1);+ assert!(apply_remove(&mut config, &added.id).is_none());+}++#[test]+fn add_validates_kind_schedule_and_target() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = config_in(&tmp);+ assert_eq!(+ apply_add(&mut config, &add_params("twitter", "x")).unwrap_err().code(),+ INVALID_REQUEST+ );+ assert_eq!(+ apply_add(+ &mut config,+ &SourcesAddParams {+ schedule_mins: Some(MIN_SCHEDULE_MINS - 1),+ ..add_params("folder", "/p")+ }+ )+ .unwrap_err()+ .code(),+ INVALID_REQUEST+ );+ assert_eq!(+ apply_add(&mut config, &add_params("link", "nope")).unwrap_err().code(),+ INVALID_REQUEST+ );+ assert!(config.memory.sources.is_empty(), "a refused add changes nothing");+ // A Composio source needs no reader.+ apply_add(&mut config, &add_params("composio", "Gmail")).unwrap();+ assert_eq!(config.memory.sources[0].target, "gmail");+}++#[test]+fn view_overlays_the_sync_state() {+ let src = source("src-1", Some(30));+ let state = state::SourceState {+ last_sync_at: Some(Utc::now()),+ status: SourceStatus::Error,+ error: Some("boom".into()),+ items: 7,+ };+ let view = view(&src, Some(&state));+ assert_eq!(view.status, SourceStatus::Error);+ assert_eq!(view.error.as_deref(), Some("boom"));+ assert_eq!(view.items, 7);+ assert_eq!(view.schedule_mins, Some(30));+ assert_eq!(super::view(&src, None).status, SourceStatus::Idle);+}++#[test]+fn is_due_follows_schedule_and_status() {+ let now = Utc::now();+ let scheduled = source("s", Some(60));+ assert!(!is_due(&source("manual", None), None, now), "on demand only");+ assert!(is_due(&scheduled, None, now), "never synced");++ let synced = |ago_mins: i64, status| state::SourceState {+ last_sync_at: Some(now - Duration::minutes(ago_mins)),+ status,+ ..state::SourceState::default()+ };+ assert!(!is_due(&scheduled, Some(&synced(59, SourceStatus::Idle)), now));+ assert!(is_due(&scheduled, Some(&synced(60, SourceStatus::Idle)), now));+ assert!(is_due(&scheduled, Some(&synced(500, SourceStatus::Error)), now), "errors retry");+ assert!(!is_due(&scheduled, Some(&synced(500, SourceStatus::Syncing)), now));+ let no_last_sync = state::SourceState::default();+ assert!(is_due(&scheduled, Some(&no_last_sync), now));+}++#[test]+fn is_due_never_schedules_faster_than_the_minimum() {+ let now = Utc::now();+ let mut eager = source("s", Some(1));+ eager.schedule_mins = Some(1);+ let state = state::SourceState {+ last_sync_at: Some(now - Duration::minutes(5)),+ ..state::SourceState::default()+ };+ assert!(!is_due(&eager, Some(&state), now));+}++#[tokio::test]+async fn forget_items_removes_only_that_sources_documents() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ let engine = bind_reference(&config);+ for (source_id, text) in [("src-a", "alpha doc"), ("src-b", "beta doc")] {+ crate::memory::ops::store_item(+ &config,+ StoreItem::Document {+ title: Some(text.into()),+ body: DocumentBody::Text(text.into()),+ mime: None,+ meta: MemoryMeta {+ source: SourceRef {+ kind: SourceKind::Folder,+ id: Some(source_id.into()),+ },+ ..MemoryMeta::default()+ },+ },+ )+ .await+ .unwrap();+ }+ assert_eq!(forget_items(&config, "src-a").await.unwrap(), 1);+ let left = stored(&engine, tinymemory::MetaFilter::default()).await;+ assert_eq!(left.len(), 1);+ assert_eq!(left[0].meta.source.id.as_deref(), Some("src-b"));+}++#[tokio::test]+async fn forget_items_with_memory_off_is_not_an_error() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ assert_eq!(forget_items(&config, "src-a").await.unwrap(), 0);+}diff --git a/crates/openhuman-core/src/memory/sources/sync_tests.rs b/crates/openhuman-core/src/memory/sources/sync_tests.rsindex 4563e55b7b..a2fbbc814d 100644--- a/crates/openhuman-core/src/memory/sources/sync_tests.rs+++ b/crates/openhuman-core/src/memory/sources/sync_tests.rs@@ -1 +1,248 @@use super::*;+use crate::memory::error::INVALID_REQUEST;+use crate::memory::sources::state;+use crate::memory::test_fixtures::{bind_reference, config_in, stored};+use tinymemory::{ItemKind, MetaFilter};++fn folder_source(id: &str, dir: &std::path::Path, mins: Option<u32>) -> MemorySourceConfig {+ MemorySourceConfig {+ id: id.to_string(),+ kind: MemorySourceKind::Folder,+ target: dir.display().to_string(),+ label: id.to_string(),+ schedule_mins: mins,+ }+}++/// A workspace with `n` markdown notes under `<action_dir>/notes`.+fn notes(config: &Config, n: usize) -> PathBuf {+ let dir = config.action_dir.join("notes");+ std::fs::create_dir_all(&dir).unwrap();+ for i in 0..n {+ std::fs::write(+ dir.join(format!("note-{i}.md")),+ format!("# Note {i}\n\nunique content number {i} about gardening"),+ )+ .unwrap();+ }+ dir+}++async fn wait_for_idle(config: &Config, id: &str) -> state::SourceState {+ for _ in 0..400 {+ if let Some(state) = state::load(&config.workspace_dir).get(id) {+ if state.status != SourceStatus::Syncing {+ return state.clone();+ }+ }+ tokio::time::sleep(std::time::Duration::from_millis(25)).await;+ }+ panic!("sync of {id} never finished");+}++#[test]+fn reader_entry_maps_every_kind() {+ let mk = |kind, target: &str| MemorySourceConfig {+ id: "s".into(),+ kind,+ target: target.into(),+ label: "L".into(),+ schedule_mins: None,+ };+ let folder = reader_entry(&mk(MemorySourceKind::Folder, "/p")).unwrap().unwrap();+ assert_eq!(folder.path.as_deref(), Some("/p"));+ let file = reader_entry(&mk(MemorySourceKind::File, "/p/a.md")).unwrap().unwrap();+ assert_eq!(file.path.as_deref(), Some("/p/a.md"));+ for (kind, target) in [+ (MemorySourceKind::Link, "https://example.com/"),+ (MemorySourceKind::Github, "https://github.com/o/r"),+ (MemorySourceKind::Rss, "https://example.com/feed"),+ ] {+ let entry = reader_entry(&mk(kind, target)).unwrap().unwrap();+ assert_eq!(entry.url.as_deref(), Some(target));+ }+ assert!(reader_entry(&mk(MemorySourceKind::Composio, "gmail")).unwrap().is_none());+}++#[tokio::test]+async fn sync_one_stores_each_file_as_a_document_tagged_with_the_source() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ let engine = bind_reference(&config);+ let dir = notes(&config, 3);+ let stored_count = sync_one(&config, &folder_source("src-notes", &dir, None))+ .await+ .unwrap();+ assert_eq!(stored_count, 3);+ let docs = stored(+ &engine,+ MetaFilter {+ kinds: vec![ItemKind::Document],+ source_id: Some("src-notes".into()),+ ..MetaFilter::default()+ },+ )+ .await;+ assert_eq!(docs.len(), 3);+}++#[tokio::test]+async fn sync_one_reports_memory_off_and_unreadable_sources() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ let dir = notes(&config, 1);+ let off = sync_one(&config, &folder_source("s", &dir, None)).await.unwrap_err();+ assert_eq!(off.code(), crate::memory::error::MEMORY_OFF);++ bind_reference(&config);+ let missing = config.action_dir.join("does-not-exist");+ assert!(sync_one(&config, &folder_source("s", &missing, None)).await.is_err());+}++#[tokio::test]+async fn start_sync_walks_syncing_then_idle_and_records_items() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = config_in(&tmp);+ bind_reference(&config);+ let dir = notes(&config, 2);+ config.memory.sources.push(folder_source("src-ok", &dir, None));++ let started = start_sync(&config, Some("src-ok")).unwrap();+ assert_eq!(started, vec!["src-ok".to_string()]);+ let done = wait_for_idle(&config, "src-ok").await;+ assert_eq!(done.status, SourceStatus::Idle);+ assert_eq!(done.items, 2);+ assert!(done.last_sync_at.is_some());+ assert!(done.error.is_none());++ // Listed through the registry view too.+ let view = crate::memory::sources::list(&config);+ assert_eq!(view[0].items, 2);+ assert_eq!(view[0].status, SourceStatus::Idle);+}++#[tokio::test]+async fn a_failing_sync_lands_in_error_with_the_message() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = config_in(&tmp);+ bind_reference(&config);+ let missing = config.action_dir.join("vanished");+ config.memory.sources.push(folder_source("src-bad", &missing, None));++ start_sync(&config, None).unwrap();+ let done = wait_for_idle(&config, "src-bad").await;+ assert_eq!(done.status, SourceStatus::Error);+ assert!(done.error.as_deref().is_some_and(|e| !e.is_empty()));+ assert!(done.last_sync_at.is_some());+}++#[test]+fn start_sync_refuses_unknown_ids_and_memory_off() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ assert_eq!(+ start_sync(&config, None).unwrap_err().code(),+ crate::memory::error::MEMORY_OFF+ );+ bind_reference(&config);+ assert_eq!(+ start_sync(&config, Some("src-nope")).unwrap_err().code(),+ INVALID_REQUEST+ );+ assert!(start_sync(&config, None).unwrap().is_empty(), "no sources, nothing started");+}++#[tokio::test]+async fn a_source_already_syncing_is_not_started_twice() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = config_in(&tmp);+ bind_reference(&config);+ let dir = notes(&config, 1);+ config.memory.sources.push(folder_source("src-once", &dir, None));+ let key = (config.workspace_dir.clone(), "src-once".to_string());+ RUNNING.lock().unwrap().insert(key.clone());+ assert!(start_sync(&config, Some("src-once")).unwrap().is_empty());+ RUNNING.lock().unwrap().remove(&key);+ assert_eq!(start_sync(&config, Some("src-once")).unwrap().len(), 1);+ wait_for_idle(&config, "src-once").await;+}++#[tokio::test]+async fn sync_due_starts_only_scheduled_sources_that_are_due() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = config_in(&tmp);+ bind_reference(&config);+ let dir = notes(&config, 1);+ config.memory.sources.push(folder_source("src-sched", &dir, Some(15)));+ config.memory.sources.push(folder_source("src-manual", &dir, None));+ config.memory.sources.push(folder_source("src-fresh", &dir, Some(15)));+ let now = Utc::now();+ state::update(&config.workspace_dir, "src-fresh", |s| {+ s.last_sync_at = Some(now);+ });++ let started = sync_due(&config, now);+ assert_eq!(started, vec!["src-sched".to_string()]);+ wait_for_idle(&config, "src-sched").await;++ // Fifteen minutes later everything scheduled is due again; manual never is.+ let later = sync_due(&config, now + chrono::Duration::minutes(16));+ assert!(later.contains(&"src-sched".to_string()));+ assert!(later.contains(&"src-fresh".to_string()));+ assert!(!later.contains(&"src-manual".to_string()));+ wait_for_idle(&config, "src-sched").await;+ wait_for_idle(&config, "src-fresh").await;+}++#[test]+fn sync_due_with_memory_off_starts_nothing() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = config_in(&tmp);+ config.memory.sources.push(folder_source("s", tmp.path(), Some(15)));+ assert!(sync_due(&config, Utc::now()).is_empty());+}++#[tokio::test]+async fn store_all_skips_a_bad_item_but_fails_when_nothing_stored() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ bind_reference(&config);+ let bound = engine::resolve(&config).engine().unwrap();+ let good = tinymemory::StoreItem::learning(+ "a good one",+ tinymemory::LearningKind::Fact,+ 0.8,+ tinymemory::MemoryMeta::default(),+ );+ let bad = tinymemory::StoreItem::learning(+ " ",+ tinymemory::LearningKind::Fact,+ 0.8,+ tinymemory::MemoryMeta::default(),+ );+ assert_eq!(+ store_all(&bound, vec![bad.clone(), good], "src").await.unwrap(),+ 1+ );+ assert!(store_all(&bound, vec![bad], "src").await.is_err());+ assert_eq!(store_all(&bound, Vec::new(), "src").await.unwrap(), 0);+}++#[test]+fn reset_interrupted_marks_syncing_sources_idle() {+ let tmp = tempfile::tempdir().unwrap();+ let ws = tmp.path();+ state::update(ws, "a", |s| s.status = SourceStatus::Syncing);+ state::update(ws, "b", |s| {+ s.status = SourceStatus::Error;+ s.error = Some("kept".into());+ });+ state::reset_interrupted(ws);+ let all = state::load(ws);+ assert_eq!(all["a"].status, SourceStatus::Idle);+ assert_eq!(all["b"].status, SourceStatus::Error);+ assert_eq!(all["b"].error.as_deref(), Some("kept"));+ state::remove(ws, "a");+ state::remove(ws, "never-there");+ assert!(!state::load(ws).contains_key("a"));+}