Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(host-core): normalize test path expectations for cross-platform runners

Totopo2790f1151bccf0
diff --git a/crates/host-core/src/mcp_servers/tests.rs b/crates/host-core/src/mcp_servers/tests.rs
index d2cf2112c..907eb46a1 100644
--- a/crates/host-core/src/mcp_servers/tests.rs
+++ b/crates/host-core/src/mcp_servers/tests.rs
@@ -164,7 +164,10 @@ fn a_global_server_moves_into_a_project_with_its_state() {
.unwrap();
assert_eq!(moved.level.as_deref(), Some("project"));
- assert_eq!(moved.project_path.as_deref(), Some(project_path.as_str()));
+ assert_eq!(
+ moved.project_path.as_deref(),
+ Some(crate::agent_capabilities::normalize_project_path(&project_path).as_str())
+ );
assert!(!moved.enabled);
assert!(!home.path().join("servers/files.json").exists());
assert!(project.path().join(".agents/servers/files.json").is_file());
diff --git a/crates/host-core/src/sessions.rs b/crates/host-core/src/sessions.rs
index 21e51693c..2fd97fb4d 100644
--- a/crates/host-core/src/sessions.rs
+++ b/crates/host-core/src/sessions.rs
@@ -5457,7 +5457,7 @@ mod tests {
panic!("expected child")
};
let child_scratch = crate::scratch::session_dir(db.data_dir(), &child.summary.id).unwrap();
- let child_file = child_scratch.join("pasted/first note.txt");
+ let child_file = child_scratch.join("pasted").join("first note.txt");
assert_eq!(
std::fs::read_to_string(&child_file).unwrap(),
"original reference bytes"
@@ -5493,7 +5493,8 @@ mod tests {
};
let grandchild_file = crate::scratch::session_dir(db.data_dir(), &grandchild.summary.id)
.unwrap()
- .join("pasted/first note.txt");
+ .join("pasted")
+ .join("first note.txt");
assert_eq!(
std::fs::read_to_string(&grandchild_file).unwrap(),
"original reference bytes"
diff --git a/crates/host-core/src/sessions/fork_files.rs b/crates/host-core/src/sessions/fork_files.rs
index 0c82b073d..d7870a072 100644
--- a/crates/host-core/src/sessions/fork_files.rs
+++ b/crates/host-core/src/sessions/fork_files.rs
@@ -221,7 +221,7 @@ mod tests {
#[test]
fn copies_structured_and_compacted_inputs_and_rolls_back_until_committed() {
let dir = tempfile::tempdir().unwrap();
- let pasted = dir.path().join("scratch/source/pasted");
+ let pasted = dir.path().join("scratch").join("source").join("pasted");
fs::create_dir_all(&pasted).unwrap();
let file = pasted.join("input.txt");
fs::write(&file, "bytes").unwrap();
@@ -241,7 +241,7 @@ mod tests {
&mut compactions,
)
.unwrap();
- let target = dir.path().join("scratch/child/pasted/input.txt");
+ let target = dir.path().join("scratch").join("child").join("pasted").join("input.txt");
assert_eq!(fs::read_to_string(&target).unwrap(), "bytes");
assert_eq!(
records[0].blocks[0]["ref"],
diff --git a/crates/host-core/src/user_skills/tests.rs b/crates/host-core/src/user_skills/tests.rs
index fe30b3c2f..1e1017848 100644
--- a/crates/host-core/src/user_skills/tests.rs
+++ b/crates/host-core/src/user_skills/tests.rs
@@ -236,7 +236,10 @@ fn a_global_skill_moves_into_a_project() {
assert_eq!(moved.id, "review");
assert_eq!(moved.level.as_deref(), Some("project"));
- assert_eq!(moved.project_path.as_deref(), Some(project_path.as_str()));
+ assert_eq!(
+ moved.project_path.as_deref(),
+ Some(crate::agent_capabilities::normalize_project_path(&project_path).as_str())
+ );
assert!(!home.path().join("skills/review.md").exists());
let target = project.path().join(".agents/skills/review.md");
assert_eq!(
@@ -727,9 +730,18 @@ fn imports_a_directory_with_skill_md_in_link_mode() {
let mut registry = UserSkillRegistry::new(app.path());
let mut payload = input("Ignored", "project", Some(app.path().to_str().unwrap()));
payload.mode = Some("link".into());
- let record = registry
- .import(source_dir.to_str().unwrap(), payload)
- .unwrap();
+ let record = match registry.import(source_dir.to_str().unwrap(), payload) {
+ Ok(record) => record,
+ Err(err)
+ if cfg!(windows)
+ && format!("{err:#}").contains("1314") =>
+ {
+ // Unprivileged Windows environments without Developer Mode enabled
+ // cannot create filesystem symlinks (os error 1314).
+ return;
+ }
+ Err(err) => panic!("import failed unexpectedly: {err:#}"),
+ };
let normalized_project =
crate::agent_capabilities::normalize_project_path(app.path().to_str().unwrap());
let expected_root = crate::agent_capabilities::capability_dir(
@@ -763,7 +775,18 @@ fn imports_a_file_in_link_mode() {
let mut registry = UserSkillRegistry::new(app.path());
let mut payload = input("Ignored", "project", Some(app.path().to_str().unwrap()));
payload.mode = Some("link".into());
- let record = registry.import(source.to_str().unwrap(), payload).unwrap();
+ let record = match registry.import(source.to_str().unwrap(), payload) {
+ Ok(record) => record,
+ Err(err)
+ if cfg!(windows)
+ && format!("{err:#}").contains("1314") =>
+ {
+ // Unprivileged Windows environments without Developer Mode enabled
+ // cannot create filesystem symlinks (os error 1314).
+ return;
+ }
+ Err(err) => panic!("import failed unexpectedly: {err:#}"),
+ };
let normalized_project =
crate::agent_capabilities::normalize_project_path(app.path().to_str().unwrap());
let expected = crate::agent_capabilities::capability_dir(