diff --git a/src/commands/doctor/shared/channel-doctor.test.ts b/src/commands/doctor/shared/channel-doctor.test.ts index 1f978168cef..80bf10a0b4b 100644 --- a/src/commands/doctor/shared/channel-doctor.test.ts +++ b/src/commands/doctor/shared/channel-doctor.test.ts @@ -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, diff --git a/src/commands/doctor/shared/channel-doctor.ts b/src/commands/doctor/shared/channel-doctor.ts index 3ec365ac014..5a3af215aa8 100644 --- a/src/commands/doctor/shared/channel-doctor.ts +++ b/src/commands/doctor/shared/channel-doctor.ts @@ -80,6 +80,9 @@ function listChannelDoctorEntries( channelIds: readonly string[], context: ChannelDoctorLookupContext, ): ChannelDoctorEntry[] { + if (channelIds.length === 0) { + return []; + } const byId = new Map(); const selectedIds = new Set(channelIds); const readOnlyPlugins = safeListReadOnlyChannelPlugins(context).filter((plugin) =>