Build: enforce mirrored Matrix dep version parity

This commit is contained in:
Gustavo Madeira Santana
2026-03-29 15:31:53 -04:00
parent c6f461563c
commit da76c94b3a
3 changed files with 97 additions and 20 deletions

View File

@@ -126,7 +126,7 @@ describe("collectBundledExtensionRootDependencyMirrorErrors", () => {
},
},
],
new Set(),
new Map(),
),
).toEqual([
"bundled extension 'matrix' manifest invalid | openclaw.releaseChecks.rootDependencyMirrorAllowlist must be an array",
@@ -151,7 +151,7 @@ describe("collectBundledExtensionRootDependencyMirrorErrors", () => {
},
},
],
new Set(["@matrix-org/matrix-sdk-crypto-wasm"]),
new Map([["@matrix-org/matrix-sdk-crypto-wasm", "18.0.0"]]),
),
).toEqual([
"bundled extension 'matrix' manifest invalid | openclaw.releaseChecks.rootDependencyMirrorAllowlist entry '@matrix-org/matrix-sdk-crypto-wasm' must be declared in extension runtime dependencies",
@@ -176,13 +176,38 @@ describe("collectBundledExtensionRootDependencyMirrorErrors", () => {
},
},
],
new Set(),
new Map(),
),
).toEqual([
"bundled extension 'matrix' manifest invalid | openclaw.releaseChecks.rootDependencyMirrorAllowlist entry '@matrix-org/matrix-sdk-crypto-wasm' must be mirrored in root runtime dependencies",
]);
});
it("flags mirror entries whose root version drifts from the extension", () => {
expect(
collectBundledExtensionRootDependencyMirrorErrors(
[
{
id: "matrix",
packageJson: {
dependencies: {
"@matrix-org/matrix-sdk-crypto-wasm": "18.0.0",
},
openclaw: {
releaseChecks: {
rootDependencyMirrorAllowlist: ["@matrix-org/matrix-sdk-crypto-wasm"],
},
},
},
},
],
new Map([["@matrix-org/matrix-sdk-crypto-wasm", "18.1.0"]]),
),
).toEqual([
"bundled extension 'matrix' manifest invalid | openclaw.releaseChecks.rootDependencyMirrorAllowlist entry '@matrix-org/matrix-sdk-crypto-wasm' must match root runtime dependency version (extension '18.0.0', root '18.1.0')",
]);
});
it("accepts mirror entries declared by both the extension and root package", () => {
expect(
collectBundledExtensionRootDependencyMirrorErrors(
@@ -201,7 +226,7 @@ describe("collectBundledExtensionRootDependencyMirrorErrors", () => {
},
},
],
new Set(["@matrix-org/matrix-sdk-crypto-wasm"]),
new Map([["@matrix-org/matrix-sdk-crypto-wasm", "18.0.0"]]),
),
).toEqual([]);
});