mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 04:31:10 +00:00
fix: harden bundled plugin dependency release checks
This commit is contained in:
@@ -19,14 +19,18 @@ const packageManifestContractTests: PackageManifestContractParams[] = [
|
||||
mirroredRootRuntimeDeps: ["@larksuiteoapi/node-sdk"],
|
||||
minHostVersionBaseline: "2026.3.22",
|
||||
},
|
||||
{ pluginId: "googlechat", minHostVersionBaseline: "2026.3.22" },
|
||||
{
|
||||
pluginId: "googlechat",
|
||||
mirroredRootRuntimeDeps: ["google-auth-library"],
|
||||
minHostVersionBaseline: "2026.3.22",
|
||||
},
|
||||
{ pluginId: "irc", minHostVersionBaseline: "2026.3.22" },
|
||||
{ pluginId: "line", minHostVersionBaseline: "2026.3.22" },
|
||||
{ pluginId: "matrix", minHostVersionBaseline: "2026.3.22" },
|
||||
{ pluginId: "mattermost", minHostVersionBaseline: "2026.3.22" },
|
||||
{
|
||||
pluginId: "memory-lancedb",
|
||||
pluginLocalRuntimeDeps: ["@lancedb/lancedb"],
|
||||
mirroredRootRuntimeDeps: ["@lancedb/lancedb", "openai"],
|
||||
minHostVersionBaseline: "2026.3.22",
|
||||
},
|
||||
{ pluginId: "msteams", minHostVersionBaseline: "2026.3.22" },
|
||||
@@ -46,7 +50,8 @@ const packageManifestContractTests: PackageManifestContractParams[] = [
|
||||
{ pluginId: "voice-call", minHostVersionBaseline: "2026.3.22" },
|
||||
{
|
||||
pluginId: "whatsapp",
|
||||
pluginLocalRuntimeDeps: ["@whiskeysockets/baileys", "jimp"],
|
||||
pluginLocalRuntimeDeps: ["@whiskeysockets/baileys"],
|
||||
mirroredRootRuntimeDeps: ["jimp"],
|
||||
minHostVersionBaseline: "2026.3.22",
|
||||
},
|
||||
{ pluginId: "zalo", minHostVersionBaseline: "2026.3.22" },
|
||||
|
||||
@@ -66,42 +66,22 @@ function readRootPackageJson(): {
|
||||
function readMatrixPackageJson(): {
|
||||
dependencies?: Record<string, string>;
|
||||
optionalDependencies?: Record<string, string>;
|
||||
openclaw?: {
|
||||
releaseChecks?: {
|
||||
rootDependencyMirrorAllowlist?: unknown;
|
||||
};
|
||||
};
|
||||
} {
|
||||
return JSON.parse(readFileSync(resolve(REPO_ROOT, "extensions/matrix/package.json"), "utf8")) as {
|
||||
dependencies?: Record<string, string>;
|
||||
optionalDependencies?: Record<string, string>;
|
||||
openclaw?: {
|
||||
releaseChecks?: {
|
||||
rootDependencyMirrorAllowlist?: unknown;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function readAmazonBedrockPackageJson(): {
|
||||
dependencies?: Record<string, string>;
|
||||
optionalDependencies?: Record<string, string>;
|
||||
openclaw?: {
|
||||
releaseChecks?: {
|
||||
rootDependencyMirrorAllowlist?: unknown;
|
||||
};
|
||||
};
|
||||
} {
|
||||
return JSON.parse(
|
||||
readFileSync(resolve(REPO_ROOT, "extensions/amazon-bedrock/package.json"), "utf8"),
|
||||
) as {
|
||||
dependencies?: Record<string, string>;
|
||||
optionalDependencies?: Record<string, string>;
|
||||
openclaw?: {
|
||||
releaseChecks?: {
|
||||
rootDependencyMirrorAllowlist?: unknown;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -327,15 +307,12 @@ describe("plugin-sdk package contract guardrails", () => {
|
||||
const rootRuntimeDeps = collectRuntimeDependencySpecs(readRootPackageJson());
|
||||
const matrixPackageJson = readMatrixPackageJson();
|
||||
const matrixRuntimeDeps = collectRuntimeDependencySpecs(matrixPackageJson);
|
||||
const allowlist = matrixPackageJson.openclaw?.releaseChecks?.rootDependencyMirrorAllowlist;
|
||||
|
||||
expect(Array.isArray(allowlist)).toBe(true);
|
||||
const matrixRootMirrorAllowlist = allowlist as string[];
|
||||
expect(matrixRootMirrorAllowlist).toEqual(
|
||||
expect.arrayContaining(["@matrix-org/matrix-sdk-crypto-wasm"]),
|
||||
);
|
||||
|
||||
for (const dep of matrixRootMirrorAllowlist) {
|
||||
for (const dep of [
|
||||
"@matrix-org/matrix-sdk-crypto-wasm",
|
||||
"@matrix-org/matrix-sdk-crypto-nodejs",
|
||||
"matrix-js-sdk",
|
||||
]) {
|
||||
expect(rootRuntimeDeps.get(dep)).toBe(matrixRuntimeDeps.get(dep));
|
||||
}
|
||||
});
|
||||
@@ -344,13 +321,8 @@ describe("plugin-sdk package contract guardrails", () => {
|
||||
const rootRuntimeDeps = collectRuntimeDependencySpecs(readRootPackageJson());
|
||||
const bedrockPackageJson = readAmazonBedrockPackageJson();
|
||||
const bedrockRuntimeDeps = collectRuntimeDependencySpecs(bedrockPackageJson);
|
||||
const allowlist = bedrockPackageJson.openclaw?.releaseChecks?.rootDependencyMirrorAllowlist;
|
||||
|
||||
expect(Array.isArray(allowlist)).toBe(true);
|
||||
const bedrockRootMirrorAllowlist = allowlist as string[];
|
||||
expect(bedrockRootMirrorAllowlist).toEqual(expect.arrayContaining(["@aws-sdk/client-bedrock"]));
|
||||
|
||||
for (const dep of bedrockRootMirrorAllowlist) {
|
||||
for (const dep of ["@aws-sdk/client-bedrock"]) {
|
||||
expect(rootRuntimeDeps.get(dep)).toBe(bedrockRuntimeDeps.get(dep));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user