From 65cddd79eb1401ea37e007c6884261cba00e85ce Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 3 Apr 2026 13:29:11 +0100 Subject: [PATCH] fix(ci): align discord actions contract with config discovery --- src/channels/plugins/contracts/registry.ts | 51 +++++++++++++--------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/channels/plugins/contracts/registry.ts b/src/channels/plugins/contracts/registry.ts index 8ea5b89a9df..fe21565ba48 100644 --- a/src/channels/plugins/contracts/registry.ts +++ b/src/channels/plugins/contracts/registry.ts @@ -176,7 +176,6 @@ function expectClearedSessionBinding(params: { ).toBeNull(); } -const discordDescribeMessageToolMock = vi.fn(); const sendMessageMatrixMock = vi.hoisted(() => vi.fn(async (to: string, _message: string, opts?: { threadId?: string }) => ({ messageId: opts?.threadId ? "$matrix-thread" : "$matrix-root", @@ -184,16 +183,6 @@ const sendMessageMatrixMock = vi.hoisted(() => })), ); -setBundledChannelRuntime("discord", { - channel: { - discord: { - messageActions: { - describeMessageTool: discordDescribeMessageToolMock, - }, - }, - }, -} as never); - setBundledChannelRuntime("line", { channel: { line: { @@ -401,17 +390,37 @@ export const actionContractRegistry: ActionsContractEntry[] = [ plugin: requireBundledChannelPlugin("discord"), cases: [ { - name: "forwards runtime-backed Discord actions and capabilities", - cfg: {} as OpenClawConfig, - expectedActions: ["send", "react", "poll"], + name: "describes configured Discord actions and capabilities", + cfg: { + channels: { + discord: { + token: "Bot token-main", + actions: { + polls: true, + reactions: true, + permissions: false, + messages: false, + pins: false, + threads: false, + search: false, + stickers: false, + memberInfo: false, + roleInfo: false, + emojiUploads: false, + stickerUploads: false, + channelInfo: false, + channels: false, + voiceStatus: false, + events: false, + roles: false, + moderation: false, + presence: false, + }, + }, + }, + } as OpenClawConfig, + expectedActions: ["send", "poll", "react", "reactions", "emoji-list"], expectedCapabilities: ["interactive", "components"], - beforeTest: () => { - discordDescribeMessageToolMock.mockReset(); - discordDescribeMessageToolMock.mockReturnValue({ - actions: ["send", "react", "poll"], - capabilities: ["interactive", "components"], - }); - }, }, ], },