build: remove private QA package compat shims

This commit is contained in:
Peter Steinberger
2026-04-27 00:25:54 +01:00
parent 09a635a28b
commit eccb79db99
19 changed files with 123 additions and 194 deletions

View File

@@ -11,9 +11,7 @@ import {
pruneBundledPluginSourceNodeModules,
runBundledPluginPostinstall,
runPluginRegistryPostinstallMigration,
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";
@@ -396,7 +394,7 @@ describe("bundled plugin postinstall", () => {
await expect(fs.stat(staleFile)).rejects.toMatchObject({ code: "ENOENT" });
});
it("restores only postinstall-generated QA compat sidecars after pruning old installs", async () => {
it("prunes stale private QA files without restoring compat sidecars", async () => {
const packageRoot = await createTempDirAsync("openclaw-packaged-install-qa-compat-");
const currentFile = path.join(packageRoot, "dist", "entry.js");
const stalePackage = path.join(packageRoot, "dist", "extensions", "qa-lab", "package.json");
@@ -422,10 +420,8 @@ describe("bundled plugin postinstall", () => {
await expect(fs.stat(stalePackage)).rejects.toMatchObject({ code: "ENOENT" });
await expect(fs.stat(staleManifest)).rejects.toMatchObject({ code: "ENOENT" });
await expect(
fs.readFile(path.join(packageRoot, "dist", "extensions", "qa-channel", "runtime-api.js"), {
encoding: "utf8",
}),
).resolves.toBe("export {};\n");
fs.stat(path.join(packageRoot, "dist", "extensions", "qa-channel", "runtime-api.js")),
).rejects.toMatchObject({ code: "ENOENT" });
await expect(
fs.stat(path.join(packageRoot, "dist", "extensions", "qa-channel", "package.json")),
).rejects.toMatchObject({ code: "ENOENT" });
@@ -433,26 +429,8 @@ describe("bundled plugin postinstall", () => {
fs.stat(path.join(packageRoot, "dist", "extensions", "qa-channel", "openclaw.plugin.json")),
).rejects.toMatchObject({ code: "ENOENT" });
await expect(
fs.readFile(path.join(packageRoot, "dist", "extensions", "qa-lab", "runtime-api.js"), {
encoding: "utf8",
}),
).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,
);
}
fs.stat(path.join(packageRoot, "dist", "extensions", "qa-lab", "runtime-api.js")),
).rejects.toMatchObject({ code: "ENOENT" });
});
it("keeps packaged postinstall non-fatal when the dist inventory is missing", async () => {