惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
小众软件
小众软件
爱范儿
爱范儿
Y
Y Combinator Blog
博客园 - Franky
美团技术团队
博客园 - 【当耐特】
The Cloudflare Blog
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
IT之家
IT之家
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
WordPress大学
WordPress大学
V
Visual Studio Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: speed up provider plugin tests · openclaw/openclaw@...
steipete · 2026-04-29 · via Recent Commits to openclaw:main

@@ -2,6 +2,7 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

22

import type { OpenClawConfig } from "../config/config.js";

33

import type { PluginAutoEnableResult } from "../config/plugin-auto-enable.js";

44

import type { PluginManifestRecord } from "./manifest-registry.js";

5+

import type { PluginRegistrySnapshot } from "./plugin-registry.js";

56

import { createEmptyPluginRegistry } from "./registry-empty.js";

67

import type { ProviderPlugin } from "./types.js";

78

@@ -125,6 +126,90 @@ function setOwningProviderManifestPluginsWithWorkspace() {

125126

]);

126127

}

127128129+

function createProviderRegistrySnapshotFixture(): PluginRegistrySnapshot {

130+

const manifestRegistry = loadPluginManifestRegistryMock();

131+

const plugins = manifestRegistry.plugins.map((plugin) => ({

132+

pluginId: plugin.id,

133+

manifestPath: plugin.manifestPath,

134+

manifestHash: `test-${plugin.id}`,

135+

source: plugin.source,

136+

rootDir: plugin.rootDir,

137+

origin: plugin.origin,

138+

enabled: plugin.enabledByDefault !== false,

139+

...(plugin.enabledByDefault === true ? { enabledByDefault: true } : {}),

140+

syntheticAuthRefs: plugin.syntheticAuthRefs,

141+

startup: {

142+

sidecar: false,

143+

memory: false,

144+

deferConfiguredChannelFullLoadUntilAfterListen: false,

145+

agentHarnesses: [],

146+

},

147+

compat: [],

148+

}));

149+150+

return {

151+

version: 1,

152+

hostContractVersion: "test",

153+

compatRegistryVersion: "test",

154+

migrationVersion: 1,

155+

policyHash: "test",

156+

generatedAtMs: 0,

157+

installRecords: {},

158+

plugins,

159+

diagnostics: [],

160+

};

161+

}

162+163+

function normalizeProviderForFixture(value: string): string {

164+

return value.trim().toLowerCase();

165+

}

166+167+

function sortUniqueFixtureValues(values: Iterable<string>): string[] {

168+

return [...new Set(values)].toSorted((left, right) => left.localeCompare(right));

169+

}

170+171+

function listManifestContributionIdsForFixture(

172+

plugin: PluginManifestRecord,

173+

contribution: string,

174+

): readonly string[] {

175+

switch (contribution) {

176+

case "providers":

177+

return plugin.providers;

178+

case "cliBackends":

179+

return plugin.cliBackends;

180+

default:

181+

return [];

182+

}

183+

}

184+185+

function resolvePluginContributionOwnersFixture(params: {

186+

contribution: string;

187+

matches: string | ((contributionId: string) => boolean);

188+

}): readonly string[] {

189+

const matcher =

190+

typeof params.matches === "string"

191+

? (contributionId: string) => contributionId === params.matches

192+

: params.matches;

193+

return sortUniqueFixtureValues(

194+

loadPluginManifestRegistryMock().plugins.flatMap((plugin) =>

195+

listManifestContributionIdsForFixture(plugin, params.contribution).some(matcher)

196+

? [plugin.id]

197+

: [],

198+

),

199+

);

200+

}

201+202+

function resolveProviderOwnersFixture(params: { providerId: string }): readonly string[] {

203+

const providerId = normalizeProviderForFixture(params.providerId);

204+

if (!providerId) {

205+

return [];

206+

}

207+

return resolvePluginContributionOwnersFixture({

208+

contribution: "providers",

209+

matches: (contributionId) => normalizeProviderForFixture(contributionId) === providerId,

210+

});

211+

}

212+128213

function getLastRuntimeRegistryCall(): Record<string, unknown> {

129214

const call = resolveRuntimePluginRegistryMock.mock.calls.at(-1)?.[0];

130215

expect(call).toBeDefined();

@@ -290,6 +375,16 @@ describe("resolvePluginProviders", () => {

290375

loadPluginManifestRegistry: (...args: Parameters<LoadPluginManifestRegistry>) =>

291376

loadPluginManifestRegistryMock(...args),

292377

}));

378+

vi.doMock("./plugin-registry.js", async () => {

379+

const actual =

380+

await vi.importActual<typeof import("./plugin-registry.js")>("./plugin-registry.js");

381+

return {

382+

...actual,

383+

loadPluginRegistrySnapshot: () => createProviderRegistrySnapshotFixture(),

384+

resolvePluginContributionOwners: resolvePluginContributionOwnersFixture,

385+

resolveProviderOwners: resolveProviderOwnersFixture,

386+

};

387+

});

293388

vi.doMock("./installed-plugin-index-store.js", async (importOriginal) => {

294389

const actual = await importOriginal<typeof import("./installed-plugin-index-store.js")>();

295390

return {