From 1a796b9700aefc2dc56a52dbf103ceb48df7e203 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 04:39:54 +0100 Subject: [PATCH] refactor: trim channel contract test helpers --- .../bundled-channel-plugin-loader.ts | 7 ---- .../group-policy-contract-suites.ts | 10 ----- .../contracts/test-helpers/registry-plugin.ts | 39 +------------------ 3 files changed, 1 insertion(+), 55 deletions(-) diff --git a/src/channels/plugins/contracts/test-helpers/bundled-channel-plugin-loader.ts b/src/channels/plugins/contracts/test-helpers/bundled-channel-plugin-loader.ts index 57243fefee5..11a46481c10 100644 --- a/src/channels/plugins/contracts/test-helpers/bundled-channel-plugin-loader.ts +++ b/src/channels/plugins/contracts/test-helpers/bundled-channel-plugin-loader.ts @@ -85,10 +85,3 @@ export function listBundledChannelPlugins(): readonly ChannelPlugin[] { return plugin ? [plugin] : []; }); } - -export async function listBundledChannelPluginsAsync(): Promise { - const plugins = await Promise.all( - listBundledChannelPluginIds().map((id) => getBundledChannelPluginAsync(id)), - ); - return plugins.filter((plugin): plugin is ChannelPlugin => Boolean(plugin)); -} diff --git a/src/channels/plugins/contracts/test-helpers/group-policy-contract-suites.ts b/src/channels/plugins/contracts/test-helpers/group-policy-contract-suites.ts index 00ecb12f70c..74bf7fea44a 100644 --- a/src/channels/plugins/contracts/test-helpers/group-policy-contract-suites.ts +++ b/src/channels/plugins/contracts/test-helpers/group-policy-contract-suites.ts @@ -1,8 +1,6 @@ import { expect, it } from "vitest"; import { resolveOpenProviderRuntimeGroupPolicy } from "../../../../config/runtime-group-policy.js"; -type ResolvedGroupPolicy = ReturnType; - export type RuntimeGroupPolicyResolver = ( params: Parameters[0], ) => ReturnType; @@ -39,11 +37,3 @@ export function installChannelRuntimeGroupPolicyFallbackSuite(params: { expect(resolved.providerMissingFallbackApplied).toBe(true); }); } - -export function expectResolvedGroupPolicyCase( - resolved: Pick, - expected: Pick, -) { - expect(resolved.groupPolicy).toBe(expected.groupPolicy); - expect(resolved.providerMissingFallbackApplied).toBe(expected.providerMissingFallbackApplied); -} diff --git a/src/channels/plugins/contracts/test-helpers/registry-plugin.ts b/src/channels/plugins/contracts/test-helpers/registry-plugin.ts index 901f181c534..67b03d53de4 100644 --- a/src/channels/plugins/contracts/test-helpers/registry-plugin.ts +++ b/src/channels/plugins/contracts/test-helpers/registry-plugin.ts @@ -1,33 +1,10 @@ import type { ChannelId } from "../../channel-id.types.js"; -import { normalizeChannelMeta } from "../../meta-normalization.js"; -import type { ChannelPlugin } from "../../types.js"; -import { - getBundledChannelCatalogEntry, - getBundledChannelPlugin, - listBundledChannelPluginIds, - listBundledChannelPlugins, -} from "./bundled-channel-plugin-loader.js"; - -type PluginContractEntry = { - id: string; - plugin: Pick; -}; +import { listBundledChannelPluginIds } from "./bundled-channel-plugin-loader.js"; type PluginContractRef = { id: ChannelId; }; -function toPluginContractEntry(plugin: ChannelPlugin): PluginContractEntry { - const existingMeta = getBundledChannelCatalogEntry(plugin.id)?.channel; - return { - id: plugin.id, - plugin: { - ...plugin, - meta: normalizeChannelMeta({ id: plugin.id, meta: plugin.meta, existing: existingMeta }), - }, - }; -} - function getBundledChannelPluginIdsForShard(params: { shardIndex: number; shardCount: number; @@ -37,20 +14,6 @@ function getBundledChannelPluginIdsForShard(params: { ); } -export function getPluginContractRegistry(): PluginContractEntry[] { - return listBundledChannelPlugins().map(toPluginContractEntry); -} - -export function getPluginContractRegistryShard(params: { - shardIndex: number; - shardCount: number; -}): PluginContractEntry[] { - return getBundledChannelPluginIdsForShard(params).flatMap((id) => { - const plugin = getBundledChannelPlugin(id); - return plugin ? [toPluginContractEntry(plugin)] : []; - }); -} - export function getPluginContractRegistryShardRefs(params: { shardIndex: number; shardCount: number;