From fbddef34bdf2c7bea5efc65cf33fe07afe278f81 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 22 Apr 2026 05:57:22 +0100 Subject: [PATCH] perf(ci): trim provider catalog test setup --- .github/actions/setup-node-env/action.yml | 2 +- .../actions/setup-pnpm-store-cache/action.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/macos-release.yml | 2 +- ...nclaw-cross-os-release-checks-reusable.yml | 2 +- .../openclaw-live-and-e2e-checks-reusable.yml | 2 +- .github/workflows/openclaw-npm-release.yml | 2 +- .github/workflows/plugin-clawhub-release.yml | 2 +- .github/workflows/plugin-npm-release.yml | 2 +- .../models/list.provider-catalog.test.ts | 98 +++++++++++++++++-- 10 files changed, 99 insertions(+), 17 deletions(-) diff --git a/.github/actions/setup-node-env/action.yml b/.github/actions/setup-node-env/action.yml index 10260f0de6c..c29e96a079b 100644 --- a/.github/actions/setup-node-env/action.yml +++ b/.github/actions/setup-node-env/action.yml @@ -14,7 +14,7 @@ inputs: pnpm-version: description: pnpm version for corepack. required: false - default: "10.32.1" + default: "10.33.0" install-bun: description: Whether to install Bun alongside Node. required: false diff --git a/.github/actions/setup-pnpm-store-cache/action.yml b/.github/actions/setup-pnpm-store-cache/action.yml index bb04dc3a584..438f70de952 100644 --- a/.github/actions/setup-pnpm-store-cache/action.yml +++ b/.github/actions/setup-pnpm-store-cache/action.yml @@ -4,7 +4,7 @@ inputs: pnpm-version: description: pnpm version to activate via corepack. required: false - default: "10.32.1" + default: "10.33.0" cache-key-suffix: description: Suffix appended to the cache key. required: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9ff7d7792f..1478f386bf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2000,7 +2000,7 @@ jobs: - name: Setup pnpm + cache store uses: ./.github/actions/setup-pnpm-store-cache with: - pnpm-version: "10.32.1" + pnpm-version: "10.33.0" cache-key-suffix: "node24" use-restore-keys: "false" use-actions-cache: "true" diff --git a/.github/workflows/macos-release.yml b/.github/workflows/macos-release.yml index ff2c09f6a7f..a6f311146f0 100644 --- a/.github/workflows/macos-release.yml +++ b/.github/workflows/macos-release.yml @@ -20,7 +20,7 @@ concurrency: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" NODE_VERSION: "24.x" - PNPM_VERSION: "10.32.1" + PNPM_VERSION: "10.33.0" jobs: validate_macos_release_request: diff --git a/.github/workflows/openclaw-cross-os-release-checks-reusable.yml b/.github/workflows/openclaw-cross-os-release-checks-reusable.yml index 6ee07b4c6f1..9a5e107cc9a 100644 --- a/.github/workflows/openclaw-cross-os-release-checks-reusable.yml +++ b/.github/workflows/openclaw-cross-os-release-checks-reusable.yml @@ -113,7 +113,7 @@ concurrency: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" NODE_VERSION: "24.x" - PNPM_VERSION: "10.32.1" + PNPM_VERSION: "10.33.0" OPENCLAW_REPOSITORY: openclaw/openclaw TSX_VERSION: "4.21.0" diff --git a/.github/workflows/openclaw-live-and-e2e-checks-reusable.yml b/.github/workflows/openclaw-live-and-e2e-checks-reusable.yml index eba268cbd9e..d6695ee3f59 100644 --- a/.github/workflows/openclaw-live-and-e2e-checks-reusable.yml +++ b/.github/workflows/openclaw-live-and-e2e-checks-reusable.yml @@ -149,7 +149,7 @@ permissions: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" NODE_VERSION: "24.x" - PNPM_VERSION: "10.32.1" + PNPM_VERSION: "10.33.0" jobs: validate_selected_ref: diff --git a/.github/workflows/openclaw-npm-release.yml b/.github/workflows/openclaw-npm-release.yml index a752087281c..64148af3dca 100644 --- a/.github/workflows/openclaw-npm-release.yml +++ b/.github/workflows/openclaw-npm-release.yml @@ -32,7 +32,7 @@ concurrency: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" NODE_VERSION: "24.x" - PNPM_VERSION: "10.32.1" + PNPM_VERSION: "10.33.0" jobs: # PLEASE DON'T ADD LONG-RUNNING OR FLAKY CHECKS TO THE npm RELEASE PATH. diff --git a/.github/workflows/plugin-clawhub-release.yml b/.github/workflows/plugin-clawhub-release.yml index 05757fe8a4c..84b52e4d768 100644 --- a/.github/workflows/plugin-clawhub-release.yml +++ b/.github/workflows/plugin-clawhub-release.yml @@ -23,7 +23,7 @@ concurrency: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" NODE_VERSION: "24.x" - PNPM_VERSION: "10.32.1" + PNPM_VERSION: "10.33.0" CLAWHUB_REGISTRY: "https://clawhub.ai" CLAWHUB_REPOSITORY: "openclaw/clawhub" # Pinned to a reviewed ClawHub commit so release behavior stays reproducible. diff --git a/.github/workflows/plugin-npm-release.yml b/.github/workflows/plugin-npm-release.yml index 8183a9df92f..2371d0e2845 100644 --- a/.github/workflows/plugin-npm-release.yml +++ b/.github/workflows/plugin-npm-release.yml @@ -38,7 +38,7 @@ concurrency: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" NODE_VERSION: "24.x" - PNPM_VERSION: "10.32.1" + PNPM_VERSION: "10.33.0" jobs: preview_plugins_npm: diff --git a/src/commands/models/list.provider-catalog.test.ts b/src/commands/models/list.provider-catalog.test.ts index 5dbda8c0120..876efa71337 100644 --- a/src/commands/models/list.provider-catalog.test.ts +++ b/src/commands/models/list.provider-catalog.test.ts @@ -1,9 +1,35 @@ -import { afterEach, describe, expect, it, vi } from "vitest"; +import { beforeEach, describe, expect, it, vi } from "vitest"; import { loadProviderCatalogModelsForList, resolveProviderCatalogPluginIdsForFilter, } from "./list.provider-catalog.js"; +const providerDiscoveryMocks = vi.hoisted(() => ({ + resolveBundledProviderCompatPluginIds: vi.fn(), + resolveOwningPluginIdsForProvider: vi.fn(), + resolvePluginDiscoveryProviders: vi.fn(), + resolveProviderContractPluginIdsForProviderAlias: vi.fn(), +})); + +vi.mock("../../plugins/providers.js", () => ({ + resolveBundledProviderCompatPluginIds: + providerDiscoveryMocks.resolveBundledProviderCompatPluginIds, + resolveOwningPluginIdsForProvider: providerDiscoveryMocks.resolveOwningPluginIdsForProvider, +})); + +vi.mock("../../plugins/contracts/registry.js", () => ({ + resolveProviderContractPluginIdsForProviderAlias: + providerDiscoveryMocks.resolveProviderContractPluginIdsForProviderAlias, +})); + +vi.mock("../../plugins/provider-discovery.js", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + resolvePluginDiscoveryProviders: providerDiscoveryMocks.resolvePluginDiscoveryProviders, + }; +}); + const baseParams = { cfg: { plugins: { @@ -21,9 +47,67 @@ const baseParams = { }, }; +const chutesProvider = { + id: "chutes", + pluginId: "chutes", + label: "Chutes", + auth: [], + staticCatalog: { + run: async () => ({ + provider: { baseUrl: "https://chutes.example/v1", models: [] }, + }), + }, +}; + +const moonshotProvider = { + id: "moonshot", + pluginId: "moonshot", + label: "Moonshot", + auth: [], + staticCatalog: { + run: async () => ({ + provider: { + baseUrl: "https://api.moonshot.ai/v1", + models: [{ id: "kimi-k2.6", name: "Kimi K2.6" }], + }, + }), + }, +}; + +const openaiProvider = { + id: "openai", + pluginId: "openai", + label: "OpenAI", + aliases: ["azure-openai-responses"], + auth: [], + staticCatalog: { + run: async () => ({ + provider: { baseUrl: "https://api.openai.com/v1", models: [] }, + }), + }, +}; + +const defaultProviders = [chutesProvider, moonshotProvider, openaiProvider]; + describe("loadProviderCatalogModelsForList", () => { - afterEach(() => { - vi.restoreAllMocks(); + beforeEach(() => { + vi.clearAllMocks(); + providerDiscoveryMocks.resolveBundledProviderCompatPluginIds.mockReturnValue([ + "chutes", + "moonshot", + "openai", + ]); + providerDiscoveryMocks.resolveOwningPluginIdsForProvider.mockImplementation( + ({ provider }: { provider: string }) => + defaultProviders.some((entry) => entry.id === provider) ? [provider] : undefined, + ); + providerDiscoveryMocks.resolveProviderContractPluginIdsForProviderAlias.mockImplementation( + (provider: string) => (provider === "azure-openai-responses" ? ["openai"] : undefined), + ); + providerDiscoveryMocks.resolvePluginDiscoveryProviders.mockImplementation( + async ({ onlyPluginIds }: { onlyPluginIds?: string[] }) => + defaultProviders.filter((provider) => onlyPluginIds?.includes(provider.pluginId)), + ); }); it("does not use live provider discovery for display-only rows", async () => { @@ -62,13 +146,11 @@ describe("loadProviderCatalogModelsForList", () => { }); it("does not execute workspace provider static catalogs", async () => { - const providers = await import("../../plugins/providers.js"); - const discovery = await import("../../plugins/provider-discovery.js"); const workspaceStaticCatalog = vi.fn(async () => ({ provider: { baseUrl: "https://workspace.example/v1", models: [] }, })); - vi.spyOn(providers, "resolveBundledProviderCompatPluginIds").mockReturnValue(["bundled-demo"]); - vi.spyOn(discovery, "resolvePluginDiscoveryProviders").mockResolvedValue([ + providerDiscoveryMocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["bundled-demo"]); + providerDiscoveryMocks.resolvePluginDiscoveryProviders.mockResolvedValue([ { id: "bundled-demo", pluginId: "bundled-demo", @@ -93,7 +175,7 @@ describe("loadProviderCatalogModelsForList", () => { ...baseParams, }); - expect(discovery.resolvePluginDiscoveryProviders).toHaveBeenCalledWith( + expect(providerDiscoveryMocks.resolvePluginDiscoveryProviders).toHaveBeenCalledWith( expect.objectContaining({ onlyPluginIds: ["bundled-demo"], includeUntrustedWorkspacePlugins: false,