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

推荐订阅源

V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
J
Java Code Geeks
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
IT之家
IT之家
博客园_首页
B
Blog RSS Feed
Google DeepMind News
Google DeepMind News
B
Blog
U
Unit 42
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
博客园 - 聂微东
腾讯CDC
A
About on SuperTechFans

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: tighten plugin registry snapshot assertions · openc...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -24,6 +24,42 @@ afterEach(() => {

2424

cleanupTrackedTempDirs(tempDirs);

2525

});

262627+

function requireRecord(value: unknown): Record<string, unknown> {

28+

expect(value).toBeTruthy();

29+

expect(typeof value).toBe("object");

30+

expect(Array.isArray(value)).toBe(false);

31+

return value as Record<string, unknown>;

32+

}

33+34+

function requirePlugin(

35+

plugins: readonly Record<string, unknown>[],

36+

id: string,

37+

): Record<string, unknown> {

38+

const plugin = plugins.find((entry) => entry.id === id);

39+

expect(plugin).toBeTruthy();

40+

return requireRecord(plugin);

41+

}

42+43+

function requireRecordArray(value: unknown): Record<string, unknown>[] {

44+

expect(Array.isArray(value)).toBe(true);

45+

return value as Record<string, unknown>[];

46+

}

47+48+

function requireNamedEntry(

49+

entries: readonly Record<string, unknown>[],

50+

name: string,

51+

): Record<string, unknown> {

52+

const entry = entries.find((candidate) => candidate.name === name);

53+

expect(entry).toBeTruthy();

54+

return requireRecord(entry);

55+

}

56+57+

function expectFields(actual: Record<string, unknown>, expected: Record<string, unknown>): void {

58+

for (const [key, value] of Object.entries(expected)) {

59+

expect(actual[key]).toEqual(value);

60+

}

61+

}

62+2763

describe("buildPluginRegistrySnapshotReport", () => {

2864

it("keeps recovered managed npm plugins visible when the persisted registry is stale", () => {

2965

const tempRoot = makeTempDir();

@@ -64,19 +100,17 @@ describe("buildPluginRegistrySnapshotReport", () => {

64100

});

6510166102

expect(report.registrySource).toBe("derived");

67-

expect(report.registryDiagnostics).toContainEqual(

68-

expect.objectContaining({ code: "persisted-registry-stale-source" }),

69-

);

70-

expect(report.plugins).toEqual(

71-

expect.arrayContaining([

72-

expect.objectContaining({

73-

id: "whatsapp",

74-

name: "WhatsApp",

75-

source: fs.realpathSync(path.join(whatsappDir, "dist", "index.js")),

76-

status: "loaded",

77-

}),

78-

]),

79-

);

103+

expect(

104+

report.registryDiagnostics.some(

105+

(diagnostic) => diagnostic.code === "persisted-registry-stale-source",

106+

),

107+

).toBe(true);

108+

expectFields(requirePlugin(report.plugins, "whatsapp"), {

109+

id: "whatsapp",

110+

name: "WhatsApp",

111+

source: fs.realpathSync(path.join(whatsappDir, "dist", "index.js")),

112+

status: "loaded",

113+

});

80114

});

8111582116

it("reconstructs list metadata from indexed manifests without importing plugin runtime", () => {

@@ -113,8 +147,7 @@ describe("buildPluginRegistrySnapshotReport", () => {

113147

},

114148

});

115149116-

const plugin = report.plugins.find((entry) => entry.id === "indexed-demo");

117-

expect(plugin).toMatchObject({

150+

expectFields(requirePlugin(report.plugins, "indexed-demo"), {

118151

id: "indexed-demo",

119152

name: "Indexed Demo",

120153

description: "Manifest-backed list metadata",

@@ -160,36 +193,37 @@ describe("buildPluginRegistrySnapshotReport", () => {

160193

},

161194

});

162195163-

const plugin = report.plugins.find((entry) => entry.id === "dependency-demo");

164-

expect(plugin?.dependencyStatus).toMatchObject({

196+

const plugin = requirePlugin(report.plugins, "dependency-demo");

197+

const dependencyStatus = requireRecord(plugin.dependencyStatus);

198+

expectFields(dependencyStatus, {

165199

hasDependencies: true,

166200

installed: false,

167201

requiredInstalled: false,

168202

optionalInstalled: false,

169203

missing: ["missing-required"],

170204

missingOptional: ["missing-optional"],

171-

dependencies: [

172-

{

173-

name: "missing-required",

174-

spec: "1.0.0",

175-

installed: false,

176-

optional: false,

177-

},

178-

{

179-

name: "present-required",

180-

spec: "1.0.0",

181-

installed: true,

182-

optional: false,

183-

},

184-

],

185-

optionalDependencies: [

186-

{

187-

name: "missing-optional",

188-

spec: "1.0.0",

189-

installed: false,

190-

optional: true,

191-

},

192-

],

205+

});

206+

const dependencies = requireRecordArray(dependencyStatus.dependencies);

207+

expect(dependencies).toHaveLength(2);

208+

expectFields(requireNamedEntry(dependencies, "missing-required"), {

209+

name: "missing-required",

210+

spec: "1.0.0",

211+

installed: false,

212+

optional: false,

213+

});

214+

expectFields(requireNamedEntry(dependencies, "present-required"), {

215+

name: "present-required",

216+

spec: "1.0.0",

217+

installed: true,

218+

optional: false,

219+

});

220+

const optionalDependencies = requireRecordArray(dependencyStatus.optionalDependencies);

221+

expect(optionalDependencies).toHaveLength(1);

222+

expectFields(requireNamedEntry(optionalDependencies, "missing-optional"), {

223+

name: "missing-optional",

224+

spec: "1.0.0",

225+

installed: false,

226+

optional: true,

193227

});

194228

expect(isColdPluginRuntimeLoaded(fixture)).toBe(false);

195229

});

@@ -230,20 +264,16 @@ describe("buildPluginRegistrySnapshotReport", () => {

230264

});

231265232266

expect(report.registrySource).toBe("persisted");

233-

expect(report.plugins).toEqual(

234-

expect.arrayContaining([

235-

expect.objectContaining({

236-

id: "persisted-demo",

237-

name: "Persisted Demo",

238-

description: "Persisted registry metadata",

239-

version: "2.0.0",

240-

providerIds: ["persisted-provider"],

241-

commands: ["persisted-demo"],

242-

source: fs.realpathSync(fixture.runtimeSource),

243-

status: "loaded",

244-

}),

245-

]),

246-

);

267+

expectFields(requirePlugin(report.plugins, "persisted-demo"), {

268+

id: "persisted-demo",

269+

name: "Persisted Demo",

270+

description: "Persisted registry metadata",

271+

version: "2.0.0",

272+

providerIds: ["persisted-provider"],

273+

commands: ["persisted-demo"],

274+

source: fs.realpathSync(fixture.runtimeSource),

275+

status: "loaded",

276+

});

247277

expect(isColdPluginRuntimeLoaded(fixture)).toBe(false);

248278

});

249279

@@ -269,17 +299,13 @@ describe("buildPluginRegistrySnapshotReport", () => {

269299

}),

270300

});

271301272-

expect(report.plugins).toEqual(

273-

expect.arrayContaining([

274-

expect.objectContaining({

275-

id: "snapshot-demo",

276-

name: "Snapshot Demo",

277-

source: fs.realpathSync(fixture.runtimeSource),

278-

status: "loaded",

279-

imported: false,

280-

}),

281-

]),

282-

);

302+

expectFields(requirePlugin(report.plugins, "snapshot-demo"), {

303+

id: "snapshot-demo",

304+

name: "Snapshot Demo",

305+

source: fs.realpathSync(fixture.runtimeSource),

306+

status: "loaded",

307+

imported: false,

308+

});

283309

expect(isColdPluginRuntimeLoaded(fixture)).toBe(false);

284310

});

285311

});