Skip to content

Commit a9a484b

Browse files
committed
test(plugins): cover load-path installed index edges
1 parent 074d148 commit a9a484b

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

src/plugins/manifest-registry-installed.test.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,62 @@ describe("loadPluginManifestRegistryForInstalledIndex", () => {
478478
expect(registry.plugins.map((plugin) => plugin.origin)).toEqual(["config", "global"]);
479479
});
480480

481+
it("skips configured load path discovery when load.paths is empty", () => {
482+
const installedRoot = makeTempDir();
483+
writePlugin(installedRoot, "installed", "installed-");
484+
const registry = loadPluginManifestRegistryForInstalledIndex({
485+
index: createIndex(installedRoot),
486+
config: {
487+
plugins: {
488+
load: { paths: [] },
489+
},
490+
},
491+
env: {
492+
OPENCLAW_VERSION: "2026.4.25",
493+
VITEST: "true",
494+
},
495+
includeDisabled: true,
496+
});
497+
498+
expect(registry.diagnostics).toStrictEqual([]);
499+
expect(registry.plugins.map((plugin) => plugin.id)).toEqual(["installed"]);
500+
});
501+
502+
it("preserves plugin id scoping for configured load path candidates", () => {
503+
const installedRoot = makeTempDir();
504+
const workspacePluginRoot = makeTempDir();
505+
const unrelatedPluginRoot = makeTempDir();
506+
writePlugin(installedRoot, "installed", "installed-");
507+
writePlugin(workspacePluginRoot, "workspace", "workspace-");
508+
writePlugin(unrelatedPluginRoot, "unrelated", "unrelated-");
509+
510+
const registry = loadPluginManifestRegistryForInstalledIndex({
511+
index: createIndex(installedRoot),
512+
config: {
513+
plugins: {
514+
load: { paths: [workspacePluginRoot, unrelatedPluginRoot] },
515+
entries: {
516+
workspace: { enabled: true },
517+
unrelated: { enabled: true },
518+
},
519+
allow: ["workspace", "unrelated"],
520+
},
521+
},
522+
env: {
523+
OPENCLAW_VERSION: "2026.4.25",
524+
VITEST: "true",
525+
},
526+
pluginIds: ["workspace"],
527+
includeDisabled: true,
528+
});
529+
530+
expect(registry.diagnostics).toStrictEqual([]);
531+
expect(registry.plugins.map((plugin) => plugin.id)).toEqual(["workspace"]);
532+
expect(registry.plugins[0]?.modelSupport).toEqual({
533+
modelPrefixes: ["workspace-"],
534+
});
535+
});
536+
481537
it("ignores redundant bundled load paths while reconstructing an installed-index registry", () => {
482538
const installedRoot = makeTempDir();
483539
const packageRoot = path.join(makeTempDir(), "node_modules", "openclaw");

0 commit comments

Comments
 (0)