From 103d7af4587c29e92a520c326893a31ca35a2774 Mon Sep 17 00:00:00 2001 From: pashpashpash Date: Wed, 22 Apr 2026 17:21:39 -0700 Subject: [PATCH] Fix legacy update compat sidecars --- .../postinstall-bundled-plugins.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/scripts/postinstall-bundled-plugins.test.ts b/test/scripts/postinstall-bundled-plugins.test.ts index 1a644e96fd0..24d6fba7465 100644 --- a/test/scripts/postinstall-bundled-plugins.test.ts +++ b/test/scripts/postinstall-bundled-plugins.test.ts @@ -10,7 +10,9 @@ import { discoverBundledPluginRuntimeDeps, pruneBundledPluginSourceNodeModules, runBundledPluginPostinstall, + restoreLegacyUpdaterCompatSidecars, } from "../../scripts/postinstall-bundled-plugins.mjs"; +import { NPM_UPDATE_COMPAT_SIDECARS } from "../../src/infra/npm-update-compat-sidecars.ts"; import { writePackageDistInventory } from "../../src/infra/package-dist-inventory.ts"; import { createScriptTestHarness } from "./test-helpers.js"; @@ -308,6 +310,22 @@ describe("bundled plugin postinstall", () => { ).resolves.toBe("export {};\n"); }); + it("keeps postinstall QA compat sidecars aligned with update verification metadata", async () => { + const packageRoot = await createTempDirAsync("openclaw-packaged-install-qa-compat-"); + + const restored = restoreLegacyUpdaterCompatSidecars({ + packageRoot, + log: { log: vi.fn(), warn: vi.fn() }, + }); + + expect(restored).toEqual(NPM_UPDATE_COMPAT_SIDECARS.map((sidecar) => sidecar.path)); + for (const sidecar of NPM_UPDATE_COMPAT_SIDECARS) { + await expect(fs.readFile(path.join(packageRoot, sidecar.path), "utf8")).resolves.toBe( + sidecar.content, + ); + } + }); + it("keeps packaged postinstall non-fatal when the dist inventory is missing", async () => { const packageRoot = await createTempDirAsync("openclaw-packaged-install-missing-inventory-"); const staleFile = path.join(packageRoot, "dist", "channel-CJUAgRQR.js");