mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:00:43 +00:00
fix: skip empty channel doctor lookup
This commit is contained in:
@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
collectChannelDoctorCompatibilityMutations,
|
||||
collectChannelDoctorEmptyAllowlistExtraWarnings,
|
||||
collectChannelDoctorStaleConfigMutations,
|
||||
createChannelDoctorEmptyAllowlistPolicyHooks,
|
||||
} from "./channel-doctor.js";
|
||||
|
||||
@@ -49,6 +50,22 @@ describe("channel doctor compatibility mutations", () => {
|
||||
expect(mocks.resolveReadOnlyChannelPluginsForConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips plugin discovery when only channel defaults are configured", async () => {
|
||||
const result = await collectChannelDoctorStaleConfigMutations({
|
||||
channels: {
|
||||
defaults: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
} as never);
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(mocks.resolveReadOnlyChannelPluginsForConfig).not.toHaveBeenCalled();
|
||||
expect(mocks.getLoadedChannelPlugin).not.toHaveBeenCalled();
|
||||
expect(mocks.getBundledChannelSetupPlugin).not.toHaveBeenCalled();
|
||||
expect(mocks.getBundledChannelPlugin).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses read-only doctor adapters for configured channel ids", () => {
|
||||
const normalizeCompatibilityConfig = vi.fn(({ cfg }: { cfg: unknown }) => ({
|
||||
config: cfg,
|
||||
|
||||
@@ -80,6 +80,9 @@ function listChannelDoctorEntries(
|
||||
channelIds: readonly string[],
|
||||
context: ChannelDoctorLookupContext,
|
||||
): ChannelDoctorEntry[] {
|
||||
if (channelIds.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const byId = new Map<string, ChannelDoctorEntry>();
|
||||
const selectedIds = new Set(channelIds);
|
||||
const readOnlyPlugins = safeListReadOnlyChannelPlugins(context).filter((plugin) =>
|
||||
|
||||
Reference in New Issue
Block a user