Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-4009: hide not-configured Composio toolkits at Service layer (#4880)

LinYushen77ba0fdddbfc
diff --git a/packages/core/api/client.ts b/packages/core/api/client.ts
index b77c3f26dc..dcf6d5f36a 100644
--- a/packages/core/api/client.ts
+++ b/packages/core/api/client.ts
@@ -2306,8 +2306,10 @@ export class ApiClient {
// Composio integration (MUL-3720). All routes are user-scoped (a connection
// belongs to a user, not a workspace), so none take a workspaceId.
- /** Full Composio toolkit catalog, each annotated with `connectable`
- * (whether the project has an enabled auth config for it). */
+ /** The project's connectable Composio toolkits (those with an enabled auth
+ * config). Since MUL-4009 the backend filters out non-connectable toolkits,
+ * so every entry has `connectable: true`. A resolver/upstream failure is a
+ * 502 rather than an empty list. */
async listComposioToolkits(): Promise<ComposioToolkit[]> {
return this.fetch(`/api/integrations/composio/toolkits`);
}
diff --git a/packages/core/composio/queries.ts b/packages/core/composio/queries.ts
index f5ffea0fd8..6bdf239522 100644
--- a/packages/core/composio/queries.ts
+++ b/packages/core/composio/queries.ts
@@ -8,9 +8,9 @@ export const composioKeys = {
connections: () => [...composioKeys.all, "connections"] as const,
};
-/** The full Composio toolkit catalog (with per-toolkit `connectable`). The
- * catalog changes rarely, so a long staleTime avoids refetching it every time
- * the Settings tab mounts. */
+/** The project's connectable Composio toolkits (those with an enabled auth
+ * config; see MUL-4009). The list changes rarely, so a long staleTime avoids
+ * refetching it every time the Settings tab mounts. */
export const composioToolkitsOptions = () =>
queryOptions({
queryKey: composioKeys.toolkits(),
diff --git a/packages/core/types/composio.ts b/packages/core/types/composio.ts
index e9a63c355c..ceb5feb6f4 100644
--- a/packages/core/types/composio.ts
+++ b/packages/core/types/composio.ts
@@ -9,9 +9,11 @@ export interface ComposioToolkit {
name: string;
logo?: string;
category?: string;
- /** Whether the project has an enabled auth config for this toolkit. When
- * false the UI must not offer a working Connect button — BeginConnect would
- * 400 with "toolkit not supported". */
+ /** Whether the project has an enabled auth config for this toolkit. Since
+ * MUL-4009 the backend only returns connectable toolkits, so this is always
+ * true on the wire; the field is kept for backward compatibility with older
+ * desktop builds that branch on it. The UI still guards the Connect button on
+ * it as a client-side backstop. */
connectable: boolean;
}
diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.json
index 38e2a560d4..1b18ba2a4f 100644
--- a/packages/views/locales/en/settings.json
+++ b/packages/views/locales/en/settings.json
@@ -302,22 +302,20 @@
},
"composio": {
"section_title": "Composio",
- "page_description": "Browse the full Composio toolkit catalog and connect the apps your agents can act on. Only toolkits with a configured auth config can be connected right now.",
+ "page_description": "Connect the Composio apps your agents can act on. Only apps configured with an enabled auth config in your Composio project appear here.",
"not_enabled_title": "Composio integration not enabled",
"not_enabled_description_prefix": "Set",
"not_enabled_description_suffix": "on the server to enable Composio toolkit connections.",
"loading": "Loading toolkits…",
"load_failed": "Failed to load Composio toolkits.",
- "empty_title": "No toolkits available",
- "empty_description": "Composio returned no toolkits. Check the API key and project configuration.",
+ "empty_title": "No connectable apps yet",
+ "empty_description": "No toolkit has an enabled auth config in your Composio project yet. Enable one in the Composio dashboard to make it available here.",
"search_placeholder": "Search toolkits…",
"connect": "Connect",
"connecting": "Connecting…",
"connected": "Connected",
"disconnect": "Disconnect",
"disconnecting": "Disconnecting…",
- "not_connectable": "Not configured",
- "not_connectable_hint": "This toolkit has no auth config in your Composio project yet, so it can't be connected. Add an auth config for it in the Composio dashboard to enable connecting.",
"connect_failed": "Couldn't start the connection. Please try again.",
"disconnect_failed": "Couldn't disconnect. Please try again.",
"toast_disconnected": "Disconnected",
diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.json
index 70501f72bf..12f7092aae 100644
--- a/packages/views/locales/ja/settings.json
+++ b/packages/views/locales/ja/settings.json
@@ -302,22 +302,20 @@
},
"composio": {
"section_title": "Composio",
- "page_description": "Browse the full Composio toolkit catalog and connect the apps your agents can act on. Only toolkits with a configured auth config can be connected right now.",
+ "page_description": "Connect the Composio apps your agents can act on. Only apps configured with an enabled auth config in your Composio project appear here.",
"not_enabled_title": "Composio integration not enabled",
"not_enabled_description_prefix": "Set",
"not_enabled_description_suffix": "on the server to enable Composio toolkit connections.",
"loading": "Loading toolkits…",
"load_failed": "Failed to load Composio toolkits.",
- "empty_title": "No toolkits available",
- "empty_description": "Composio returned no toolkits. Check the API key and project configuration.",
+ "empty_title": "No connectable apps yet",
+ "empty_description": "No toolkit has an enabled auth config in your Composio project yet. Enable one in the Composio dashboard to make it available here.",
"search_placeholder": "Search toolkits…",
"connect": "Connect",
"connecting": "Connecting…",
"connected": "Connected",
"disconnect": "Disconnect",
"disconnecting": "Disconnecting…",
- "not_connectable": "Not configured",
- "not_connectable_hint": "This toolkit has no auth config in your Composio project yet, so it can't be connected. Add an auth config for it in the Composio dashboard to enable connecting.",
"connect_failed": "Couldn't start the connection. Please try again.",
"disconnect_failed": "Couldn't disconnect. Please try again.",
"toast_disconnected": "Disconnected",
diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.json
index 62675bd21f..596168e954 100644
--- a/packages/views/locales/ko/settings.json
+++ b/packages/views/locales/ko/settings.json
@@ -379,22 +379,20 @@
},
"composio": {
"section_title": "Composio",
- "page_description": "Browse the full Composio toolkit catalog and connect the apps your agents can act on. Only toolkits with a configured auth config can be connected right now.",
+ "page_description": "Connect the Composio apps your agents can act on. Only apps configured with an enabled auth config in your Composio project appear here.",
"not_enabled_title": "Composio integration not enabled",
"not_enabled_description_prefix": "Set",
"not_enabled_description_suffix": "on the server to enable Composio toolkit connections.",
"loading": "Loading toolkits…",
"load_failed": "Failed to load Composio toolkits.",
- "empty_title": "No toolkits available",
- "empty_description": "Composio returned no toolkits. Check the API key and project configuration.",
+ "empty_title": "No connectable apps yet",
+ "empty_description": "No toolkit has an enabled auth config in your Composio project yet. Enable one in the Composio dashboard to make it available here.",
"search_placeholder": "Search toolkits…",
"connect": "Connect",
"connecting": "Connecting…",
"connected": "Connected",
"disconnect": "Disconnect",
"disconnecting": "Disconnecting…",
- "not_connectable": "Not configured",
- "not_connectable_hint": "This toolkit has no auth config in your Composio project yet, so it can't be connected. Add an auth config for it in the Composio dashboard to enable connecting.",
"connect_failed": "Couldn't start the connection. Please try again.",
"disconnect_failed": "Couldn't disconnect. Please try again.",
"toast_disconnected": "Disconnected",
diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.json
index 3c4b3e161e..e9d8324f0c 100644
--- a/packages/views/locales/zh-Hans/settings.json
+++ b/packages/views/locales/zh-Hans/settings.json
@@ -302,22 +302,20 @@
},
"composio": {
"section_title": "Composio",
- "page_description": "浏览 Composio 的全部 toolkit,连接你的 agent 可以操作的应用。目前只有已配置 auth config 的 toolkit 可以连接。",
+ "page_description": "连接你的 agent 可以操作的 Composio 应用。这里只展示你在 Composio 项目里已配置(启用了 auth config)的应用。",
"not_enabled_title": "Composio 集成未启用",
"not_enabled_description_prefix": "在服务器上设置",
"not_enabled_description_suffix": "以启用 Composio toolkit 连接。",
"loading": "正在加载 toolkit…",
"load_failed": "加载 Composio toolkit 失败。",
- "empty_title": "没有可用的 toolkit",
- "empty_description": "Composio 未返回任何 toolkit。请检查 API key 和项目配置。",
+ "empty_title": "还没有可连接的应用",
+ "empty_description": "你的 Composio 项目里还没有启用 auth config 的 toolkit。请在 Composio 后台启用一个 auth config,它才会出现在这里。",
"search_placeholder": "搜索 toolkit…",
"connect": "连接",
"connecting": "连接中…",
"connected": "已连接",
"disconnect": "断开",
"disconnecting": "断开中…",
- "not_connectable": "未配置",
- "not_connectable_hint": "该 toolkit 在你的 Composio 项目中还没有 auth config,因此无法连接。请在 Composio 后台为它添加一个 auth config 后再连接。",
"connect_failed": "无法发起连接,请重试。",
"disconnect_failed": "无法断开连接,请重试。",
"toast_disconnected": "已断开",
diff --git a/packages/views/settings/components/composio-tab.tsx b/packages/views/settings/components/composio-tab.tsx
index bef474f82b..1ba5d35786 100644
--- a/packages/views/settings/components/composio-tab.tsx
+++ b/packages/views/settings/components/composio-tab.tsx
@@ -28,12 +28,16 @@ import { ComposioToolkitLogo } from "../../common/composio-toolkit-logo";
import { useT, useTimeAgo } from "../../i18n";
import { useNavigation } from "../../navigation";
-// ComposioTab renders the full Composio toolkit catalog and lets the user
-// connect / disconnect the apps their agents can act on.
+// ComposioTab renders the connectable Composio toolkit catalog and lets the
+// user connect / disconnect the apps their agents can act on.
//
-// Key UX rule (MUL-3720): listing ≠ connectable. Only toolkits with an enabled
-// auth config in the Composio project carry `connectable: true`; the rest get a
-// muted "not configured" hint instead of a dead Connect button that would 400.
+// Key UX rule (MUL-4009): the backend only returns toolkits with an enabled
+// auth config in the Composio project, so every card here is connectable —
+// toolkits with no auth config are filtered out server-side rather than shown
+// with a dead "not configured" hint. The `toolkit.connectable` guard on the
+// Connect button is kept as a client-side backstop (older/misbehaving servers
+// could still send a non-connectable entry); such an entry simply renders no
+// action affordance rather than a broken Connect button that would 400.
export function ComposioTab() {
const { t } = useT("settings");
const qc = useQueryClient();
@@ -351,14 +355,7 @@ function ToolkitCard({
)}
{connecting ? t(($) => $.composio.connecting) : t(($) => $.composio.connect)}
</Button>
- ) : (
- <span
- className="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground"
- title={t(($) => $.composio.not_connectable_hint)}
- >
- {t(($) => $.composio.not_connectable)}
- </span>
- )}
+ ) : null}
</CardContent>
</Card>
);
diff --git a/server/internal/handler/integrations_composio.go b/server/internal/handler/integrations_composio.go
index 126016b69d..d088c212c9 100644
--- a/server/internal/handler/integrations_composio.go
+++ b/server/internal/handler/integrations_composio.go
@@ -44,9 +44,10 @@ type ComposioConnectionResponse struct {
}
// ComposioToolkitResponse is the wire shape for one toolkit in the catalog.
-// connectable is the key UX signal: false means the project has no enabled
-// auth config for the toolkit, so the UI must not offer a working Connect
-// button (BeginConnect would 400).
+// Since MUL-4009 the catalog only contains connectable toolkits, so
+// `connectable` is always true. The field is retained for backward
+// compatibility with older desktop clients that branch on it (dropping it would
+// make them treat every entry as non-connectable and hide the Connect button).
type ComposioToolkitResponse struct {
Slug string `json:"slug"`
Name string `json:"name"`
@@ -162,11 +163,13 @@ func (h *Handler) ListComposioConnections(w http.ResponseWriter, r *http.Request
}
// ListComposioToolkits (GET /api/integrations/composio/toolkits) returns the
-// full Composio toolkit catalog for the Settings UI to render. Each entry
-// carries a `connectable` flag: only toolkits with an enabled auth config in
-// the project can actually be connected, so the UI gates its Connect button on
-// it. The catalog itself is project-global (not per-user), but the route is
-// user-scoped (requireUser) like the rest of the block.
+// connectable Composio toolkits for the Settings UI to render. Since MUL-4009
+// the service filters out toolkits with no enabled auth config in the project,
+// so every entry here is connectable; the `connectable` flag is kept on the
+// wire for backward compatibility. The catalog itself is project-global (not
+// per-user), but the route is user-scoped (requireUser) like the rest of the
+// block. A resolver/upstream failure is a 502, letting the UI show its
+// load-failed state rather than a misleading empty catalog.
func (h *Handler) ListComposioToolkits(w http.ResponseWriter, r *http.Request) {
if h.Composio == nil || !h.composioMCPAppsEnabled(r.Context()) {
writeError(w, http.StatusServiceUnavailable, "composio integration not configured")
diff --git a/server/internal/handler/integrations_composio_test.go b/server/internal/handler/integrations_composio_test.go
index efcade6dbd..dc480557a8 100644
--- a/server/internal/handler/integrations_composio_test.go
+++ b/server/internal/handler/integrations_composio_test.go
@@ -3,6 +3,7 @@ package handler
import (
"context"
"encoding/json"
+ "errors"
"net/http"
"net/http/httptest"
"strings"
@@ -25,6 +26,9 @@ const composioTestUserID = "22222222-2222-2222-2222-222222222222"
type composioFakeSDK struct {
createLinkResp *sdk.CreateLinkResponse
revokeErr error
+ // listAuthErr, when set, makes ListAuthConfigs fail. This propagates through
+ // Service.authConfigMap → ListToolkits, exercising the handler's 502 path.
+ listAuthErr error
}
func (f *composioFakeSDK) CreateLink(_ context.Context, _ sdk.CreateLinkRequest) (*sdk.CreateLinkResponse, error) {
@@ -54,6 +58,9 @@ func (f *composioFakeSDK) DeleteConnectedAccount(_ context.Context, _ string) er
// ListAuthConfigs reports a single enabled notion auth config so BeginConnect
// resolves notion → ac_notion and the callback's auth-config check matches.
func (f *composioFakeSDK) ListAuthConfigs(_ context.Context, _ sdk.ListAuthConfigsRequest) (*sdk.ListAuthConfigsResponse, error) {
+ if f.listAuthErr != nil {
+ return nil, f.listAuthErr
+ }
return &sdk.ListAuthConfigsResponse{Items: []sdk.AuthConfig{{
ID: "ac_notion",
Toolkit: sdk.Toolkit{Slug: "notion"},
@@ -224,16 +231,17 @@ func TestComposio_ListToolkits(t *testing.T) {
if err := json.Unmarshal(w.Body.Bytes(), &toolkits); err != nil {
t.Fatalf("decode: %v", err)
}
- if len(toolkits) != 2 {
- t.Fatalf("expected 2 toolkits, got %d", len(toolkits))
+ // Only notion has an enabled auth config; github is filtered out server-side
+ // (MUL-4009), so a single connectable toolkit comes back.
+ if len(toolkits) != 1 {
+ t.Fatalf("expected 1 toolkit, got %d (%s)", len(toolkits), w.Body.String())
}
- // notion has an enabled auth config in the fake → connectable + sorted first.
if toolkits[0].Slug != "notion" || !toolkits[0].Connectable {
- t.Errorf("first toolkit = %+v, want connectable notion", toolkits[0])
+ t.Errorf("toolkit = %+v, want connectable notion", toolkits[0])
}
for _, tk := range toolkits {
- if tk.Slug == "github" && tk.Connectable {
- t.Error("github has no auth config and must not be connectable")
+ if tk.Slug == "github" {
+ t.Error("github has no auth config and must be filtered out")
}
if tk.Logo == "" {
t.Errorf("toolkit %q missing logo", tk.Slug)
@@ -241,6 +249,21 @@ func TestComposio_ListToolkits(t *testing.T) {
}
}
+// TestComposio_ListToolkits_ResolverErrorIs502 pins the key behavior of this
+// PR (MUL-4009): when the service can't resolve which toolkits are connectable
+// (auth-config lookup fails), ListComposioToolkits must return 502 rather than
+// silently degrading to an empty catalog. A regression back to a soft empty
+// list would render as a misleading "no apps configured" state.
+func TestComposio_ListToolkits_ResolverErrorIs502(t *testing.T) {
+ h := newComposioTestHandler(t, &composioFakeSDK{listAuthErr: errors.New("auth_configs upstream blip")}, &composioFakeStore{})
+
+ w := httptest.NewRecorder()
+ h.ListComposioToolkits(w, composioReq(http.MethodGet, "/toolkits", ""))
+ if w.Code != http.StatusBadGateway {
+ t.Fatalf("expected 502 on resolver error, got %d (%s)", w.Code, w.Body.String())
+ }
+}
+
func TestComposio_CallbackRedirects(t *testing.T) {
store := &composioFakeStore{}
diff --git a/server/internal/integrations/composio/service.go b/server/internal/integrations/composio/service.go
index 462094d35d..cd4cfd4475 100644
--- a/server/internal/integrations/composio/service.go
+++ b/server/internal/integrations/composio/service.go
@@ -18,7 +18,6 @@ import (
"errors"
"fmt"
"net/url"
- "sort"
"strings"
"sync"
"time"
@@ -205,8 +204,10 @@ type MCPSession struct {
// exactly the fields the Settings UI renders plus a Connectable flag.
//
// Connectable means the project has an enabled auth config for the toolkit, so
-// BeginConnect would succeed. When false the UI must not offer a working
-// "Connect" affordance — clicking it would 400 with ErrToolkitNotSupported.
+// BeginConnect would succeed. Since MUL-4009 ListToolkits only returns
+// connectable toolkits, so this is always true on the wire; the field is
+// retained for backward compatibility with older desktop clients that branch on
+// it (removing it would make them treat every entry as non-connectable).
type ToolkitView struct {
Slug string `json:"slug"`
Name string `json:"name"`
@@ -482,19 +483,28 @@ func rowToConnection(row db.UserComposioConnection) Connection {
return c
}
-// ListToolkits returns the full Composio toolkit catalog annotated with a
-// Connectable flag (whether the project has an enabled auth config for each).
-// It fetches all pages (capped by maxToolkitPages) so the UI gets the complete
-// list in one call; the catalog is a few hundred entries, well within a single
-// JSON response. Connectable toolkits are surfaced first so the UI can lead
-// with what actually works.
+// ListToolkits returns only the Composio toolkits the project can actually
+// connect (those with an enabled auth config). Toolkits with no enabled auth
+// config are filtered out entirely (MUL-4009): a card the user can't act on is
+// noise, and the old "Not configured" grey label existed only to avoid a dead
+// button — dropping the entry removes the need for it. It fetches all pages
+// (capped by maxToolkitPages) so the UI gets the complete connectable list in
+// one call; the catalog is a few hundred entries, well within a single JSON
+// response. Every returned entry has Connectable == true, preserving Composio's
+// usage order.
+//
+// Unlike the previous behavior, a resolver error is NOT masked into an
+// everything-not-connectable catalog: with filtering in place that would render
+// as a silent "no apps configured" empty state, which is misleading. We return
+// the error so the handler can surface a 502 and the UI can show its honest
+// load-failed state instead.
func (s *Service) ListToolkits(ctx context.Context) ([]ToolkitView, error) {
// connectable is the project's enabled toolkit_slug → auth_config_id map.
- // On a transient resolver error we still render the catalog, just with
- // everything marked not-connectable, rather than failing the whole list.
+ // It is the source of truth for what to surface: only slugs present here
+ // are returned.
connectable, err := s.authConfigMap(ctx)
if err != nil {
- connectable = map[string]string{}
+ return nil, fmt.Errorf("composio: resolve connectable toolkits: %w", err)
}
out := []ToolkitView{}
@@ -518,17 +528,24 @@ func (s *Service) ListToolkits(ctx context.Context) ([]ToolkitView, error) {
continue
}
seen[slug] = struct{}{}
+ // Filter out toolkits with no enabled auth config: the user has no
+ // working action for them, so they are omitted from the catalog.
+ if _, canConnect := connectable[slug]; !canConnect {
+ continue
+ }
category := ""
if len(tk.Categories) > 0 {
category = tk.Categories[0]
}
- _, canConnect := connectable[slug]
out = append(out, ToolkitView{
- Slug: tk.Slug,
- Name: tk.Name,
- LogoURL: toolkitLogoURL(slug, tk.LogoURL),
- Category: category,
- Connectable: canConnect,
+ Slug: tk.Slug,
+ Name: tk.Name,
+ LogoURL: toolkitLogoURL(slug, tk.LogoURL),
+ Category: category,
+ // Every surfaced toolkit is connectable by construction. The
+ // wire field is kept (see ComposioToolkitResponse) for backward
+ // compatibility with older desktop clients that branch on it.
+ Connectable: true,
})
}
if resp.NextCursor == "" {
@@ -537,14 +554,6 @@ func (s *Service) ListToolkits(ctx context.Context) ([]ToolkitView, error) {
cursor = resp.NextCursor
}
- // Stable sort: connectable toolkits first, preserving Composio's usage
- // order within each group.
- sort.SliceStable(out, func(i, j int) bool {
- if out[i].Connectable != out[j].Connectable {
- return out[i].Connectable
- }
- return false
- })
return out, nil
}
diff --git a/server/internal/integrations/composio/service_test.go b/server/internal/integrations/composio/service_test.go
index 2f981ac101..bc98f07d19 100644
--- a/server/internal/integrations/composio/service_test.go
+++ b/server/internal/integrations/composio/service_test.go
@@ -312,15 +312,16 @@ func TestBeginConnect_PrefersCustomAuthConfig(t *testing.T) {
}
}
-// TestListToolkits_ConnectableFlagAndOrder: every toolkit is listed, but only
-// those with an enabled auth config are connectable, and connectable ones sort
-// first.
-func TestListToolkits_ConnectableFlagAndOrder(t *testing.T) {
+// TestListToolkits_FiltersToConnectable: only toolkits with an enabled auth
+// config are returned (MUL-4009); the rest are dropped from the catalog, and
+// every surfaced entry is Connectable by construction.
+func TestListToolkits_FiltersToConnectable(t *testing.T) {
t.Parallel()
sdkFake := &fakeSDK{
authConfigsSet: true,
authConfigs: []sdk.AuthConfig{
{ID: "ac_notion", Toolkit: sdk.Toolkit{Slug: "notion"}, Status: "ENABLED"},
+ {ID: "ac_slack", Toolkit: sdk.Toolkit{Slug: "slack"}, Status: "ENABLED"},
},
toolkits: []sdk.Toolkit{
{Slug: "github", Name: "GitHub", LogoURL: "https://logo/gh", Categories: []string{"dev"}},
@@ -333,32 +334,39 @@ func TestListToolkits_ConnectableFlagAndOrder(t *testing.T) {
if err != nil {
t.Fatalf("ListToolkits: %v", err)
}
- if len(tks) != 3 {
- t.Fatalf("expected 3 toolkits, got %d", len(tks))
+ // notion and slack have enabled auth configs; github is filtered out.
+ if len(tks) != 2 {
+ t.Fatalf("expected 2 connectable toolkits, got %d: %+v", len(tks), tks)
}
- // Connectable (notion) sorts first.
- if tks[0].Slug != "notion" || !tks[0].Connectable {
- t.Errorf("first toolkit = %+v, want connectable notion", tks[0])
+ bySlug := make(map[string]ToolkitView, len(tks))
+ for _, tk := range tks {
+ if !tk.Connectable {
+ t.Errorf("surfaced toolkit %q must be connectable", tk.Slug)
+ }
+ if tk.Slug == "github" {
+ t.Errorf("non-connectable toolkit %q should have been filtered out", tk.Slug)
+ }
+ bySlug[tk.Slug] = tk
}
- if tks[0].Name != "Notion" || tks[0].LogoURL != "https://logo/notion" || tks[0].Category != "productivity" {
- t.Errorf("notion fields not mapped: %+v", tks[0])
+ notion, ok := bySlug["notion"]
+ if !ok {
+ t.Fatalf("expected notion in results: %+v", tks)
}
- for _, tk := range tks[1:] {
- if tk.Connectable {
- t.Errorf("toolkit %q should not be connectable", tk.Slug)
- }
+ if notion.Name != "Notion" || notion.LogoURL != "https://logo/notion" || notion.Category != "productivity" {
+ t.Errorf("notion fields not mapped: %+v", notion)
}
- for _, tk := range tks {
- if tk.Slug == "slack" && tk.LogoURL != "https://logos.composio.dev/api/slack" {
- t.Errorf("slack default logo = %q", tk.LogoURL)
- }
+ // slack carried no upstream logo, so the composio default logo URL is derived.
+ if slack, ok := bySlug["slack"]; !ok || slack.LogoURL != "https://logos.composio.dev/api/slack" {
+ t.Errorf("slack default logo = %+v", bySlug["slack"])
}
}
-// TestListToolkits_PaginatesAndResolverErrorIsSoft: a paginated catalog is
-// fully drained, and an /auth_configs failure degrades to "nothing
-// connectable" instead of failing the whole list.
-func TestListToolkits_ResolverErrorMarksNoneConnectable(t *testing.T) {
+// TestListToolkits_ResolverErrorReturnsError: an /auth_configs failure is
+// surfaced as an error rather than silently degrading to an empty catalog
+// (MUL-4009). With filtering in place, masking the error would render as a
+// misleading "no apps configured" empty state, so the handler must be able to
+// return a 502 instead.
+func TestListToolkits_ResolverErrorReturnsError(t *testing.T) {
t.Parallel()
sdkFake := &fakeSDK{
listAuthErr: errors.New("upstream blip"),
@@ -366,11 +374,11 @@ func TestListToolkits_ResolverErrorMarksNoneConnectable(t *testing.T) {
}
svc := newTestService(t, sdkFake, newFakeStore())
tks, err := svc.ListToolkits(context.Background())
- if err != nil {
- t.Fatalf("ListToolkits should not fail on auth-config error, got %v", err)
+ if err == nil {
+ t.Fatalf("ListToolkits should fail on auth-config resolver error, got %+v", tks)
}
- if len(tks) != 1 || tks[0].Connectable {
- t.Fatalf("expected 1 non-connectable toolkit, got %+v", tks)
+ if tks != nil {
+ t.Errorf("expected nil toolkits on error, got %+v", tks)
}
}