From 2416e2d51df455aaa312883deece348291e08b93 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 4 Apr 2026 04:19:58 +0100 Subject: [PATCH] fix(ci): repair seam drift and matrix test timing --- extensions/discord/src/channel.ts | 7 ++-- .../matrix/src/matrix/monitor/events.test.ts | 39 ++++++++----------- extensions/slack/src/channel.ts | 4 +- src/config/io.write-config.test.ts | 22 ++++++++--- src/plugin-sdk/status-helpers.ts | 1 + 5 files changed, 41 insertions(+), 32 deletions(-) diff --git a/extensions/discord/src/channel.ts b/extensions/discord/src/channel.ts index 44b19b0ab9b..fa77cae8c27 100644 --- a/extensions/discord/src/channel.ts +++ b/extensions/discord/src/channel.ts @@ -250,7 +250,8 @@ const resolveDiscordAllowlistGroupOverrides = createNestedAllowlistOverrideResol const resolveDiscordAllowlistNames = createAccountScopedAllowlistNameResolver({ resolveAccount: resolveDiscordAccount, resolveToken: (account: ResolvedDiscordAccount) => account.token, - resolveNames: ({ token, entries }) => resolveDiscordUserAllowlist({ token, entries }), + resolveNames: async ({ token, entries }) => + (await loadDiscordResolveUsersModule()).resolveDiscordUserAllowlist({ token, entries }), }); const collectDiscordSecurityWarnings = @@ -465,8 +466,8 @@ export const discordPlugin: ChannelPlugin (await loadDiscordDirectoryConfigModule()).listDiscordDirectoryGroupsFromConfig(params), ...createRuntimeDirectoryLiveAdapter({ getRuntime: loadDiscordDirectoryLiveModule, - listPeersLive: (runtime) => runtime.listDirectoryPeersLive, - listGroupsLive: (runtime) => runtime.listDirectoryGroupsLive, + listPeersLive: (runtime) => runtime.listDiscordDirectoryPeersLive, + listGroupsLive: (runtime) => runtime.listDiscordDirectoryGroupsLive, }), }), resolver: { diff --git a/extensions/matrix/src/matrix/monitor/events.test.ts b/extensions/matrix/src/matrix/monitor/events.test.ts index bce2862ac5e..df00941e60e 100644 --- a/extensions/matrix/src/matrix/monitor/events.test.ts +++ b/extensions/matrix/src/matrix/monitor/events.test.ts @@ -194,30 +194,25 @@ describe("registerMatrixMonitorEvents verification routing", () => { }); it("still posts fresh verification completions", async () => { - vi.useFakeTimers(); - vi.setSystemTime(new Date("2026-03-14T13:10:00.000Z")); - try { - const { sendMessage, roomEventListener } = createHarness(); + const { sendMessage, roomEventListener } = createHarness(); - roomEventListener("!room:example.org", { - event_id: "$done-fresh", - sender: "@alice:example.org", - type: "m.key.verification.done", - origin_server_ts: Date.now(), - content: { - "m.relates_to": { event_id: "$req-fresh" }, - }, - }); + roomEventListener("!room:example.org", { + event_id: "$done-fresh", + sender: "@alice:example.org", + type: "m.key.verification.done", + origin_server_ts: Date.now(), + content: { + "m.relates_to": { event_id: "$req-fresh" }, + }, + }); - await vi.waitFor(() => { - expect(sendMessage).toHaveBeenCalledTimes(1); - }); - expect(getSentNoticeBody(sendMessage)).toContain( - "Matrix verification completed with @alice:example.org.", - ); - } finally { - vi.useRealTimers(); - } + await vi.dynamicImportSettled(); + await vi.waitFor(() => { + expect(sendMessage).toHaveBeenCalledTimes(1); + }); + expect(getSentNoticeBody(sendMessage)).toContain( + "Matrix verification completed with @alice:example.org.", + ); }); it("forwards reaction room events into the shared room handler", async () => { diff --git a/extensions/slack/src/channel.ts b/extensions/slack/src/channel.ts index 1cdffd6cf3b..e56c3915bec 100644 --- a/extensions/slack/src/channel.ts +++ b/extensions/slack/src/channel.ts @@ -360,8 +360,8 @@ export const slackPlugin: ChannelPlugin = crea (await loadSlackDirectoryConfigModule()).listSlackDirectoryGroupsFromConfig(params), ...createRuntimeDirectoryLiveAdapter({ getRuntime: loadSlackDirectoryLiveModule, - listPeersLive: (runtime) => runtime.listDirectoryPeersLive, - listGroupsLive: (runtime) => runtime.listDirectoryGroupsLive, + listPeersLive: (runtime) => runtime.listSlackDirectoryPeersLive, + listGroupsLive: (runtime) => runtime.listSlackDirectoryGroupsLive, }), }), resolver: { diff --git a/src/config/io.write-config.test.ts b/src/config/io.write-config.test.ts index 509cd8460f5..9066232033b 100644 --- a/src/config/io.write-config.test.ts +++ b/src/config/io.write-config.test.ts @@ -2,6 +2,7 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; +import type { PluginManifestRegistry } from "../plugins/manifest-registry.js"; import { createConfigIO } from "./io.js"; import type { OpenClawConfig } from "./types.js"; @@ -10,14 +11,16 @@ import type { OpenClawConfig } from "./types.js"; // test exercise the exact code path that caused the bug: AJV injecting // defaults during the write-back validation pass. const mockLoadPluginManifestRegistry = vi.hoisted(() => - vi.fn(() => ({ - diagnostics: [], - plugins: [], - })), + vi.fn( + (): PluginManifestRegistry => ({ + diagnostics: [], + plugins: [], + }), + ), ); vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: (...args: unknown[]) => mockLoadPluginManifestRegistry(...args), + loadPluginManifestRegistry: mockLoadPluginManifestRegistry, })); describe("config io write", () => { @@ -424,8 +427,17 @@ describe("config io write", () => { plugins: [ { id: "bluebubbles", + name: "BlueBubbles", + version: "0.0.0-test", origin: "bundled", channels: ["bluebubbles"], + providers: [], + cliBackends: [], + skills: [], + hooks: [], + rootDir: "/mock/bluebubbles", + source: "bundled", + manifestPath: "/mock/bluebubbles/openclaw.plugin.json", channelCatalogMeta: { id: "bluebubbles", label: "BlueBubbles", diff --git a/src/plugin-sdk/status-helpers.ts b/src/plugin-sdk/status-helpers.ts index cff1a6933d4..9299585dcd6 100644 --- a/src/plugin-sdk/status-helpers.ts +++ b/src/plugin-sdk/status-helpers.ts @@ -3,6 +3,7 @@ import type { ChannelAccountSnapshot } from "../channels/plugins/types.core.js"; import type { ChannelStatusIssue } from "../channels/plugins/types.js"; import type { OpenClawConfig } from "../config/config.js"; export type { ChannelAccountSnapshot } from "../channels/plugins/types.core.js"; +export type { ChannelStatusIssue } from "../channels/plugins/types.js"; export { isRecord } from "../channels/plugins/status-issues/shared.js"; export { appendMatchMetadata,