mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:50:46 +00:00
fix(doctor): drop stale bundled install records
This commit is contained in:
@@ -743,6 +743,52 @@ describe("repairMissingConfiguredPluginInstalls", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("removes stale bundled install records even when the plugin is not configured", async () => {
|
||||
const records = {
|
||||
"google-meet": {
|
||||
source: "npm",
|
||||
spec: "@openclaw/google-meet",
|
||||
resolvedName: "@openclaw/google-meet",
|
||||
installPath: "/missing/google-meet",
|
||||
},
|
||||
};
|
||||
mocks.loadInstalledPluginIndexInstallRecords.mockResolvedValue(records);
|
||||
mocks.loadPluginMetadataSnapshot.mockReturnValue({
|
||||
plugins: [],
|
||||
diagnostics: [],
|
||||
});
|
||||
mocks.loadInstalledPluginIndex.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
pluginId: "google-meet",
|
||||
origin: "bundled",
|
||||
packageName: "@openclaw/google-meet",
|
||||
},
|
||||
],
|
||||
diagnostics: [],
|
||||
installRecords: {},
|
||||
});
|
||||
|
||||
const { repairMissingConfiguredPluginInstalls } =
|
||||
await import("./missing-configured-plugin-install.js");
|
||||
const result = await repairMissingConfiguredPluginInstalls({
|
||||
cfg: {},
|
||||
env: {},
|
||||
});
|
||||
|
||||
expect(mocks.installPluginFromNpmSpec).not.toHaveBeenCalled();
|
||||
expect(mocks.writePersistedInstalledPluginIndexInstallRecords).toHaveBeenCalledWith(
|
||||
{},
|
||||
{
|
||||
env: {},
|
||||
},
|
||||
);
|
||||
expect(result).toEqual({
|
||||
changes: ['Removed stale managed install record for bundled plugin "google-meet".'],
|
||||
warnings: [],
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
"npm",
|
||||
|
||||
@@ -646,11 +646,7 @@ async function repairMissingPluginInstalls(params: {
|
||||
|
||||
for (const [pluginId, record] of Object.entries(records)) {
|
||||
const bundled = bundledPluginsById.get(pluginId);
|
||||
if (
|
||||
!bundled ||
|
||||
!params.pluginIds.has(pluginId) ||
|
||||
!recordMatchesBundledPackage(record, bundled)
|
||||
) {
|
||||
if (!bundled || !recordMatchesBundledPackage(record, bundled)) {
|
||||
continue;
|
||||
}
|
||||
if (nextRecords === records) {
|
||||
|
||||
Reference in New Issue
Block a user