fix(permissions): tools MCP inter-projets exposés (idea_project_*) + contactable agent/template persisté — update_agent_contactable (application/web-server/app-tauri), defaultContactable TemplateEditor save/reopen, groupes MCP 'IdeA inter-projets' avec fallback, permissions agent Contactable — #267 (QA verte)

This commit is contained in:
2026-09-07 18:13:27 +02:00
parent 9266d121cd
commit f6101a8249
30 changed files with 632 additions and 89 deletions

View File

@ -5,7 +5,8 @@
use app_tauri_lib::dto::{
parse_agent_id, AgentDto, AgentListDto, CellKind, ConversationDetailsDto,
CreateAgentRequestDto, InspectConversationRequestDto, LaunchAgentRequestDto, LiveAgentListDto,
TerminalSessionDto, UpdateAgentContextRequestDto, UpdateAgentEffortRequestDto,
TerminalSessionDto, UpdateAgentContactableRequestDto, UpdateAgentContextRequestDto,
UpdateAgentEffortRequestDto,
};
use application::AppError;
use application::{
@ -40,7 +41,7 @@ fn make_agent(agent_uuid: u128, profile_uuid: u128) -> Agent {
#[test]
fn agent_dto_serialises_camelcase() {
let agent = make_agent(1, 2);
let agent = make_agent(1, 2).with_contactable(true);
let dto = AgentDto::from_agent(agent.clone());
let v = serde_json::to_value(&dto).unwrap();
@ -52,6 +53,7 @@ fn agent_dto_serialises_camelcase() {
ProfileId::from_uuid(Uuid::from_u128(2)).to_string()
);
assert_eq!(v["synchronized"], false);
assert_eq!(v["contactable"], true);
// origin: tagged `{ "type": "scratch" }`
assert_eq!(v["origin"]["type"], "scratch");
assert_eq!(v["capabilities"], json!([]));
@ -173,6 +175,19 @@ fn update_agent_effort_request_deserialises_and_null_clears() {
assert_eq!(clear.effort, None);
}
#[test]
fn update_agent_contactable_request_deserialises_camelcase() {
let raw = json!({
"projectId": Uuid::from_u128(1).to_string(),
"agentId": Uuid::from_u128(2).to_string(),
"contactable": true
});
let dto: UpdateAgentContactableRequestDto = serde_json::from_value(raw).unwrap();
assert!(dto.contactable);
assert_eq!(dto.project_id, Uuid::from_u128(1).to_string());
assert_eq!(dto.agent_id, Uuid::from_u128(2).to_string());
}
#[test]
fn launch_agent_request_deserialises_camelcase() {
let project_id = Uuid::from_u128(1).to_string();