From 2a404f6226791c132cb1c0fef13e4f1147f4e271 Mon Sep 17 00:00:00 2001 From: Jeremy Yao Date: Sat, 10 Oct 2026 09:37:00 -0400 Subject: [PATCH] MCP: the auto-save recovery tests look for the JSON-quoted path automation autosave_is_durable_before_reply_and_queries_do_not_rotate and the CLI's mcp_autosave_survives_kill_and_restart_without_touching_ desktop_settings asserted that the initialize instructions contain the previous session's auto-save path as raw text. The instructions embed the auto-save info as JSON, so on Windows the path's backslashes are escaped and the raw match can never succeed (both failed on every Windows run; the server's reply is right). They now look for the path as serde_json prints it, which also matches on Linux and macOS. Co-Authored-By: Claude Fable 5.1 --- apps/effectcraft-cli/tests/cli.rs | 4 +++- crates/automation/src/tests.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/effectcraft-cli/tests/cli.rs b/apps/effectcraft-cli/tests/cli.rs index 723016a8..51bdcc4c 100644 --- a/apps/effectcraft-cli/tests/cli.rs +++ b/apps/effectcraft-cli/tests/cli.rs @@ -373,7 +373,9 @@ fn mcp_autosave_survives_kill_and_restart_without_touching_desktop_settings() { assert_eq!(manifest["ended"], false); let mut restarted = McpChild::start(&config, true); let init = restarted.rpc("initialize", json!({})); - assert!(init["instructions"].as_str().unwrap().contains(path)); + // The instructions embed the auto-save info as JSON, so the path appears JSON-quoted (on + // Windows with its backslashes escaped). + assert!(init["instructions"].as_str().unwrap().contains(&json!(path).to_string())); assert_eq!(init["_meta"]["effectcraftAutoSave"]["previousSessions"][0]["autosave"], path); restarted.tool("open_project", json!({"path":path})); let comp = restarted.tool("get_comp", json!({"comp":"Survives restart"})); diff --git a/crates/automation/src/tests.rs b/crates/automation/src/tests.rs index 44a61cc1..b4090ca7 100644 --- a/crates/automation/src/tests.rs +++ b/crates/automation/src/tests.rs @@ -269,7 +269,9 @@ fn autosave_is_durable_before_reply_and_queries_do_not_rotate() { drop(s); // Abrupt process loss has no EOF cleanup; the checkpoint already exists. let mut restarted = server().with_autosave(&dir).unwrap(); let init = rpc(&mut restarted, 1, "initialize", json!({})); - assert!(init["instructions"].as_str().unwrap().contains(path)); + // The instructions embed the auto-save info as JSON, so the path appears JSON-quoted (on + // Windows with its backslashes escaped). + assert!(init["instructions"].as_str().unwrap().contains(&json!(path).to_string())); assert_eq!(init["_meta"]["effectcraftAutoSave"]["previousSessions"][0]["autosave"], path); call_json(&mut restarted, "open_project", json!({"path": path})); assert_eq!(call_json(&mut restarted, "get_project", json!({}))["items"][0]["name"], "Durable");