Skip to content

Commit baec38c

Browse files
committed
refactor(plugins): consolidate descriptor and startup ownership
1 parent a1b41d5 commit baec38c

7 files changed

Lines changed: 259 additions & 971 deletions

‎src/plugins/discovery-threading.test.ts‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ vi.mock("./discovery.js", async (importOriginal) => {
1414
});
1515

1616
const { loadPluginManifestRegistry } = await import("./manifest-registry.js");
17-
const { resolveInstalledPluginIndexRegistry } =
18-
await import("./installed-plugin-index-registry.js");
17+
const { loadInstalledPluginIndexWithDiscovery } = await import("./installed-plugin-index.js");
1918

2019
const emptyDiscovery: PluginDiscoveryResult = { candidates: [], diagnostics: [] };
2120

@@ -30,7 +29,7 @@ describe("discovery threading", () => {
3029
expect(discoverOpenClawPluginsMock).not.toHaveBeenCalled();
3130

3231
discoverOpenClawPluginsMock.mockClear();
33-
resolveInstalledPluginIndexRegistry({ discovery: emptyDiscovery, installRecords: {} });
32+
loadInstalledPluginIndexWithDiscovery({ discovery: emptyDiscovery, installRecords: {} });
3433
expect(discoverOpenClawPluginsMock).not.toHaveBeenCalled();
3534
});
3635

@@ -39,7 +38,7 @@ describe("discovery threading", () => {
3938
expect(discoverOpenClawPluginsMock).toHaveBeenCalledTimes(1);
4039

4140
discoverOpenClawPluginsMock.mockClear();
42-
resolveInstalledPluginIndexRegistry({ installRecords: {} });
41+
loadInstalledPluginIndexWithDiscovery({ installRecords: {} });
4342
expect(discoverOpenClawPluginsMock).toHaveBeenCalledTimes(1);
4443
});
4544

@@ -48,7 +47,7 @@ describe("discovery threading", () => {
4847
expect(discoverOpenClawPluginsMock).not.toHaveBeenCalled();
4948

5049
discoverOpenClawPluginsMock.mockClear();
51-
resolveInstalledPluginIndexRegistry({
50+
loadInstalledPluginIndexWithDiscovery({
5251
candidates: [],
5352
discovery: emptyDiscovery,
5453
installRecords: {},
@@ -63,9 +62,13 @@ describe("discovery threading", () => {
6362
);
6463
const diagnostics = [{ level: "warn" as const, message: "explicit candidate diagnostic" }];
6564

66-
const result = resolveInstalledPluginIndexRegistry({ candidates: [], diagnostics });
65+
const result = loadInstalledPluginIndexWithDiscovery({
66+
candidates: [],
67+
diagnostics,
68+
installRecords: {},
69+
});
6770

68-
expect(result.registry.diagnostics).toEqual(diagnostics);
71+
expect(result.manifestRegistry.diagnostics).toEqual(diagnostics);
6972
expect(result.discovery).toBeUndefined();
7073
expect(readInstallRecords).not.toHaveBeenCalled();
7174
expect(discoverOpenClawPluginsMock).not.toHaveBeenCalled();

0 commit comments

Comments
 (0)