Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

test: gate the Unix-only service tests; fix macOS dead code and importer fmt

AkitaOnRails1b503e8bdafd
diff --git a/companions/ai-memory-importer/src/agentmemory/vault.rs b/companions/ai-memory-importer/src/agentmemory/vault.rs
index 32c38906..1b653c1d 100644
--- a/companions/ai-memory-importer/src/agentmemory/vault.rs
+++ b/companions/ai-memory-importer/src/agentmemory/vault.rs
@@ -496,7 +496,10 @@ pub(crate) mod tests {
td.path(),
"memories/m.md",
// Split so secret scanners do not flag the fixture.
- concat!("---\nid: \"ghp_", "1234567890abcdefghijklmnopqrstuvwxyzAB\"\n---\n# M"),
+ concat!(
+ "---\nid: \"ghp_",
+ "1234567890abcdefghijklmnopqrstuvwxyzAB\"\n---\n# M"
+ ),
);
assert!(plan(td.path(), &dest(), DEFAULT_DEST_PREFIX).is_err());
diff --git a/crates/ai-memory-cli/src/commands/setup.rs b/crates/ai-memory-cli/src/commands/setup.rs
index f4311957..f36c0138 100644
--- a/crates/ai-memory-cli/src/commands/setup.rs
+++ b/crates/ai-memory-cli/src/commands/setup.rs
@@ -685,6 +685,8 @@ mod tests {
/// A server that already answers with no unit of ours in place is not
/// ours to replace; once our unit exists, a running server is the one it
/// started and the unit is managed as usual.
+ // Windows skips the service step before this decision.
+ #[cfg(unix)]
#[test]
fn an_answering_server_without_our_unit_is_left_in_charge() {
let tmp = tempfile::tempdir().unwrap();
diff --git a/crates/ai-memory-cli/src/commands/user_service.rs b/crates/ai-memory-cli/src/commands/user_service.rs
index de783750..589ce973 100644
--- a/crates/ai-memory-cli/src/commands/user_service.rs
+++ b/crates/ai-memory-cli/src/commands/user_service.rs
@@ -556,7 +556,9 @@ fn delete_unit(path: &Path) -> Result<()> {
std::fs::remove_file(path).with_context(|| format!("removing {}", path.display()))
}
-#[cfg(test)]
+// The service step is Unix-only (systemd user units, launchd), and these
+// tests render and drive it with Unix paths.
+#[cfg(all(test, unix))]
mod tests {
use super::*;
use std::cell::RefCell;
diff --git a/crates/ai-memory-cli/tests/suite/setup_e2e.rs b/crates/ai-memory-cli/tests/suite/setup_e2e.rs
index f926e23f..2ebb34a1 100644
--- a/crates/ai-memory-cli/tests/suite/setup_e2e.rs
+++ b/crates/ai-memory-cli/tests/suite/setup_e2e.rs
@@ -7,7 +7,7 @@
#![cfg(unix)]
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
use std::process::{Command, Output, Stdio};
use crate::e2e_support::hermetic;
@@ -17,6 +17,8 @@ const BIN: &str = env!("CARGO_BIN_EXE_ai-memory");
/// A temp root holding the operator's home and a directory of fake tools.
struct Sandbox {
_tmp: tempfile::TempDir,
+ // Only the Linux service test reads it.
+ #[cfg_attr(not(target_os = "linux"), allow(dead_code))]
root: PathBuf,
home: PathBuf,
}
@@ -125,6 +127,7 @@ fn setup_without_yes_and_without_a_terminal_changes_nothing() {
mod slow {
use super::*;
use serde_json::{Value, json};
+ use std::path::Path;
use std::time::{Duration, Instant};
/// `systemctl --user` stand-in. `restart` runs the unit's `ExecStart`