fix(plugins): disable incompatible plugins before lazy contributions

This commit is contained in:
Codex committed 2026-10-26 02:54:41 +00:00
1 parent 0256e7471d
commit e20f2a9986
5 files changed
+160

No files matched your search

+23
View File
@@ -488,3 +488,26 @@ test("shutdown cancels an in-flight runtime mutation before waiting for its queu
"database:close",
]);
});
test("explicit enable checks compatibility before clearing quarantine or exposing lazy contributions", async () => {
const calls = [];
const plugin = { id: "com.example.incompatible", enabled: false, runtime: { quarantinedAt: 1 } };
const manager = new PluginManager({
database: {
getActivePlugin: () => plugin,
clearQuarantine: () => calls.push("clear"),
setEnabled: () => calls.push("enable"),
},
packageStore: {
async initialize() {},
async assertCompatible() { throw new Error("Plugin is incompatible"); },
},
runtimeSupervisor: {},
contributionService: {
async initialize() {},
onPluginEnabled: () => calls.push("contribute"),
},
});
await assert.rejects(manager.setEnabled(plugin.id, true), /incompatible/);
assert.deepEqual(calls, []);
});