Complete local-first content migration slice

This commit is contained in:
2026-08-05 16:24:04 -05:00
parent 993abb96df
commit f850bae77c
60 changed files with 2755 additions and 2729 deletions
+39 -1
View File
@@ -1,10 +1,11 @@
use std::collections::HashMap;
use std::path::PathBuf;
use ai::diff_validation::ParsedDiff;
use ai::skills::{SkillPathOrigin, SkillReference};
use galaxy_agent_core::ToolCall;
use super::action_from_tool_call;
use super::{action_from_tool_call, MCPToolTarget};
use crate::ai::agent::{AIAgentActionType, FileEdit};
fn call(name: &str, arguments: serde_json::Value) -> ToolCall {
@@ -28,6 +29,7 @@ fn shell_calls_become_domain_actions_without_a_proto_round_trip() {
}),
),
&SkillPathOrigin::Local,
&HashMap::new(),
)
.unwrap();
@@ -60,6 +62,7 @@ fn edit_calls_preserve_file_edits_in_the_domain_model() {
}),
),
&SkillPathOrigin::Local,
&HashMap::new(),
)
.unwrap();
@@ -86,6 +89,7 @@ fn grouped_mcp_calls_keep_the_installation_uuid_and_json_input() {
serde_json::json!({"message": "hello"}),
),
&SkillPathOrigin::Local,
&HashMap::new(),
)
.unwrap();
@@ -101,6 +105,38 @@ fn grouped_mcp_calls_keep_the_installation_uuid_and_json_input() {
));
}
#[test]
fn provider_safe_mcp_aliases_resolve_to_the_original_tool() {
let server_id = uuid::Uuid::parse_str("10804e3a-859e-4474-bf89-80e98d1dd086").unwrap();
let alias = "mcp__performance_analyze_insight__0123456789abcdef";
let aliases = HashMap::from([(
alias.to_string(),
MCPToolTarget {
server_id: Some(server_id),
name: "performance_analyze_insight".to_string(),
},
)]);
let action = action_from_tool_call(
"task-1",
&call(alias, serde_json::json!({"trace_id": "trace-1"})),
&SkillPathOrigin::Local,
&aliases,
)
.unwrap();
assert!(matches!(
action.action,
AIAgentActionType::CallMCPTool {
server_id: Some(actual_server_id),
name,
input,
} if actual_server_id == server_id
&& name == "performance_analyze_insight"
&& input == serde_json::json!({"trace_id": "trace-1"})
));
}
#[test]
fn local_skill_paths_preserve_the_session_origin() {
let action = action_from_tool_call(
@@ -113,6 +149,7 @@ fn local_skill_paths_preserve_the_session_origin() {
}),
),
&SkillPathOrigin::Local,
&HashMap::new(),
)
.unwrap();
@@ -133,6 +170,7 @@ fn unknown_tools_are_rejected_before_the_permission_boundary() {
"task-1",
&call("invented_tool", serde_json::json!({})),
&SkillPathOrigin::Local,
&HashMap::new(),
)
.unwrap_err();