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

@ -121,6 +121,39 @@ describe("PermissionsPanel — Tools MCP IdeA tab", () => {
})).toBeTruthy();
});
it("shows cross-project tools in their UX group and catalogued unmapped tools in Autres", async () => {
const agent = new MockAgentGateway();
const permission = new MockPermissionGateway();
permission.setMcpToolCatalogue({
readOnlyTools: ["idea_project_list", "idea_future_read"],
writeActionTools: ["idea_project_ask_agent"],
});
const gateways = {
agent,
permission,
profile: new MockProfileGateway(),
} as unknown as Gateways;
render(
<DIProvider gateways={gateways}>
<PermissionsPanel projectId={PROJECT_ID} />
</DIProvider>,
);
await openMcpToolsTab();
expect(screen.getByRole("button", { name: /IdeA inter-projets/ })).toBeTruthy();
expect(
screen.getByRole("checkbox", {
name: /Demander à un agent d'un autre projet, idea_project_ask_agent$/,
}),
).toBeTruthy();
expect(screen.getByRole("button", { name: /Autres/ })).toBeTruthy();
const fallback = screen.getByRole("checkbox", {
name: /idea_future_read, idea_future_read$/,
}) as HTMLInputElement;
expect(fallback.disabled).toBe(false);
});
it("creating an override prefills the draft with the current effective allowlist", async () => {
await renderPanel();
await openMcpToolsTab();
@ -156,14 +189,14 @@ describe("PermissionsPanel — Tools MCP IdeA tab", () => {
await selectAgentTarget("DevFrontend");
fireEvent.click(screen.getByRole("button", { name: "Créer un override" }));
expect(screen.getByText(/9 lecture autorisés · 0 écriture autorisé/)).toBeTruthy();
expect(screen.getByText(/16 lecture autorisés · 0 écriture autorisé/)).toBeTruthy();
const writeCheckbox = screen.getByRole("checkbox", {
name: /idea_ticket_update_carnet$/,
});
fireEvent.click(writeCheckbox);
expect(screen.getByText(/9 lecture autorisés · 1 écriture autorisé/)).toBeTruthy();
expect(screen.getByText(/16 lecture autorisés · 1 écriture autorisé/)).toBeTruthy();
expect(screen.getByText("Modifications non enregistrées")).toBeTruthy();
expect(screen.getByText("Ajouté")).toBeTruthy();
});
@ -196,7 +229,7 @@ describe("PermissionsPanel — Tools MCP IdeA tab", () => {
"idea_ticket_update_carnet",
]),
);
expect(calledPolicy?.allowedTools).toHaveLength(10);
expect(calledPolicy?.allowedTools).toHaveLength(17);
// Persisted: the left-column badge flips to Override, and Réinitialiser appears.
const nav = screen.getByRole("navigation", { name: "cibles des permissions MCP" });