package claude import ( "testing" "amadan.net/oficina/equipo/internal/runner/provider" ) // The coordinator's launch accepts exactly its tool set: every tool the // conversation offers (add_report since slice 4c) builds a policy, and // one it does not offer is refused. The launcher's own list once lagged // the action's, and every coordinator start failed policy_rejected. func TestConversePolicyCoversEveryTool(t *testing.T) { profile, err := provider.Profile("converse") if err != nil { t.Fatal(err) } b := provider.Binding{Provider: "claude", CredentialHome: "/private/account", Home: "/private/run", RuntimeRoot: "/private/runtime"} in := provider.PolicyInputs{Action: "converse", Tools: profile.MCPTools()} if _, err := PolicyInputs(b, in, profile.Specialist, "model"); err != nil { t.Fatalf("converse tools %v: %v", profile.MCPTools(), err) } in.Tools = append(profile.MCPTools(), "mcp__equipo__merge_now") if _, err := PolicyInputs(b, in, profile.Specialist, "model"); err == nil { t.Fatal("a tool the conversation does not offer was accepted") } } func TestAccessLegacyPolicy(t *testing.T) { p, _ := provider.Profile("converse") tools := p.MCPTools()[1:] b := provider.Binding{Provider: "claude", CredentialHome: "/private/account", Home: "/private/run", RuntimeRoot: "/private/runtime"} if _, err := PolicyInputs(b, provider.PolicyInputs{Action: "converse", Tools: tools}, p.Specialist, "model"); err != nil { t.Fatal("legacy tool set refused", err) } tools = append(tools, "mcp__equipo__merge_now") if _, err := PolicyInputs(b, provider.PolicyInputs{Action: "converse", Tools: tools}, p.Specialist, "model"); err == nil { t.Fatal("unexpected extra tool allowed") } }