mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:30:45 +00:00
fix(plugins): keep enabled-only registry migration fresh
This commit is contained in:
@@ -551,6 +551,43 @@ describe("installed plugin index", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not mark enabled-only migration snapshots stale for omitted disabled plugins", () => {
|
||||
const enabledFixture = createRichPluginFixture();
|
||||
const disabledFixture = createRichPluginFixture();
|
||||
writePluginManifest(disabledFixture.rootDir, {
|
||||
id: "disabled-demo",
|
||||
name: "Disabled Demo",
|
||||
configSchema: { type: "object" },
|
||||
providers: ["disabled-demo"],
|
||||
});
|
||||
const current = loadInstalledPluginIndex({
|
||||
candidates: [
|
||||
enabledFixture.candidate,
|
||||
{
|
||||
...disabledFixture.candidate,
|
||||
idHint: "disabled-demo",
|
||||
},
|
||||
],
|
||||
config: {
|
||||
plugins: {
|
||||
entries: {
|
||||
"disabled-demo": {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
env: hermeticEnv(),
|
||||
});
|
||||
const migratedEnabledOnly = {
|
||||
...current,
|
||||
refreshReason: "migration" as const,
|
||||
plugins: current.plugins.filter((plugin) => plugin.enabled),
|
||||
};
|
||||
|
||||
expect(diffInstalledPluginIndexInvalidationReasons(migratedEnabledOnly, current)).toEqual([]);
|
||||
});
|
||||
|
||||
it("marks disabled plugins without dropping their cold contributions", () => {
|
||||
const fixture = createRichPluginFixture();
|
||||
|
||||
|
||||
@@ -731,6 +731,10 @@ export function diffInstalledPluginIndexInvalidationReasons(
|
||||
}
|
||||
for (const pluginId of currentByPluginId.keys()) {
|
||||
if (!previousByPluginId.has(pluginId)) {
|
||||
const currentPlugin = currentByPluginId.get(pluginId);
|
||||
if (currentPlugin?.enabled === false) {
|
||||
continue;
|
||||
}
|
||||
reasons.add("source-changed");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user