fix(plugins): warn on install source package drift

Warn when provider or channel catalog package identity drifts from openclaw.install.npmSpec while keeping compatible catalogs non-fatal.
This commit is contained in:
Vincent Koc
2026-04-24 09:31:40 -07:00
committed by GitHub
parent 90877e0d42
commit 4d1ee3a73e
9 changed files with 162 additions and 12 deletions

View File

@@ -209,5 +209,43 @@ export function describeOfficialFallbackChannelCatalogContract(params: {
expect(entry?.meta.label).toBe(params.externalLabel);
expect(entry?.pluginId).toBeUndefined();
});
it("surfaces package-name drift in external channel catalog install metadata", () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-drifted-catalog-"));
const catalogPath = path.join(dir, "catalog.json");
fs.writeFileSync(
catalogPath,
JSON.stringify({
entries: [
{
name: params.packageName,
openclaw: {
channel: params.meta,
install: {
npmSpec: `${params.packageName}-fork@1.2.3`,
expectedIntegrity: "sha512-drifted",
},
},
},
],
}),
"utf8",
);
const entry = listChannelPluginCatalogEntries({
catalogPaths: [catalogPath],
officialCatalogPaths: [],
env: {
...process.env,
OPENCLAW_BUNDLED_PLUGINS_DIR: "/nonexistent/bundled/plugins",
},
}).find((item) => item.id === params.channelId);
expect(entry?.installSource?.npm).toMatchObject({
packageName: `${params.packageName}-fork`,
expectedPackageName: params.packageName,
});
expect(entry?.installSource?.warnings).toEqual(["npm-spec-package-name-mismatch"]);
});
});
}