package provider import ( "errors" "reflect" "slices" "testing" "amadan.net/oficina/equipo/internal/specialist" ) // TestDesignActionProfile: the Design step's action profile (design-v1's // Policy.Action) has exactly render_page, submit_candidate and // ask_person, design-v1's tools in its order, and never the old // submit_render; it is the Design role's, writes its workspace, and is // the only action that may read /render. func TestDesignActionProfile(t *testing.T) { menu, ok := specialist.Lookup(specialist.ProfileDesign) if !ok || menu.Policy.Action != DesignStepAction { t.Fatalf("design-v1's action is %q, the runner's %q", menu.Policy.Action, DesignStepAction) } p, err := Profile(DesignStepAction) if err != nil { t.Fatal(err) } want := ActionProfile{Action: "design_step", Specialist: "Design", Submission: "submit_candidate"} if p != want { t.Fatalf("profile %+v, want %+v", p, want) } if got := p.Tools(); !slices.Equal(got, []string{"render_page", "submit_candidate", "ask_person"}) || !slices.Equal(got, menu.Tools) { t.Fatalf("tools %v, design-v1 %v", got, menu.Tools) } if got := p.MCPTools(); !slices.Equal(got, []string{"mcp__equipo__render_page", "mcp__equipo__submit_candidate", "mcp__equipo__ask_person"}) { t.Fatalf("MCP tools %v", got) } if !p.AcceptsTools(DesignMCPTools()) { t.Fatal("its own tools refused") } for name, tools := range map[string][]string{ "the old submit_render": append(p.MCPTools(), "mcp__equipo__submit_render"), "no render_page": {"mcp__equipo__submit_candidate", "mcp__equipo__ask_person"}, "Engineering's": {"mcp__equipo__submit_candidate", "mcp__equipo__ask_person", "mcp__equipo__submit_render"}, "research's": {"mcp__equipo__submit_findings", "mcp__equipo__keep_image"}, "none": {}, } { if p.AcceptsTools(tools) { t.Errorf("%s accepted", name) } } // Only the Design step reads /render; nothing else, Engineering // above all, and not the plan workflow's legacy design action. for _, action := range []string{"implement", "design", "copy", "inspect", "review", "answer", "converse", "assist", "coordinate", ResearchStepAction, GlanceAction, ""} { if RenderReaderAction(action) { t.Errorf("%q reads /render", action) } } if !RenderReaderAction(DesignStepAction) || !DesignAction(DesignStepAction) || DesignAction("design") || ResearchReaderAction(DesignStepAction) { t.Fatal("the design step's reads") } } // TestEngineeringActionUnchanged: Engineering's action profile and tool // list, as they were before Design (byte for byte), and the plan // workflow's legacy design action left as it was. func TestEngineeringActionUnchanged(t *testing.T) { for action, want := range map[string]struct { profile ActionProfile tools []string }{ "implement": {ActionProfile{Action: "implement", Specialist: "Engineering", Submission: "submit_candidate", Render: true}, []string{"submit_candidate", "ask_person", "submit_render"}}, "design": {ActionProfile{Action: "design", Specialist: "Design", Submission: "submit_candidate", Render: true}, []string{"submit_candidate", "ask_person", "submit_render"}}, } { p, err := Profile(action) if err != nil || p != want.profile || !reflect.DeepEqual(p.Tools(), want.tools) { t.Fatalf("%s: %+v %v %v", action, p, p.Tools(), err) } } if _, err := Profile("design-v1"); !errors.Is(err, ErrPolicy) { t.Fatal("a profile id is not an action") } }