mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 14:34:47 +00:00
fix: reject unowned CLI roots before plugin load (#76379)
Co-authored-by: Neil <neil@neilofneils.com>
This commit is contained in:
@@ -407,7 +407,7 @@ describe("registerPluginCliCommands", () => {
|
||||
expect(mocks.memoryListAction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("keeps full CLI loading when primary command planning finds no plugin match", async () => {
|
||||
it("scopes full CLI loading through CLI metadata when manifest planning finds no plugin match", async () => {
|
||||
const program = createProgram();
|
||||
program.exitOverride();
|
||||
|
||||
@@ -416,13 +416,28 @@ describe("registerPluginCliCommands", () => {
|
||||
primary: "memory",
|
||||
});
|
||||
|
||||
expect(mocks.loadOpenClawPluginCliRegistry).toHaveBeenCalled();
|
||||
expect(mocks.loadOpenClawPlugins).toHaveBeenCalledWith(
|
||||
expect.not.objectContaining({
|
||||
onlyPluginIds: expect.anything(),
|
||||
expect.objectContaining({
|
||||
onlyPluginIds: ["memory-core"],
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("skips full plugin runtime loading when no metadata owns the requested primary", async () => {
|
||||
const program = createProgram();
|
||||
program.exitOverride();
|
||||
|
||||
await registerPluginCliCommands(program, {} as OpenClawConfig, undefined, undefined, {
|
||||
mode: "lazy",
|
||||
primary: "missing-command",
|
||||
});
|
||||
|
||||
expect(mocks.loadOpenClawPluginCliRegistry).toHaveBeenCalled();
|
||||
expect(mocks.loadOpenClawPlugins).not.toHaveBeenCalled();
|
||||
expect(program.commands.map((command) => command.name())).not.toContain("missing-command");
|
||||
});
|
||||
|
||||
it("returns null for validated plugin CLI config when the snapshot is invalid", async () => {
|
||||
mocks.readConfigFileSnapshot.mockResolvedValueOnce({
|
||||
valid: false,
|
||||
|
||||
Reference in New Issue
Block a user