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

@@ -333,16 +333,26 @@ describe("collectForbiddenPackedPathErrors", () => {
"dist/extensions/qa-channel/package.json",
"dist/extensions/qa-lab/runtime-api.js",
"dist/extensions/qa-lab/src/cli.js",
"dist/plugin-sdk/extensions/qa-channel/api.d.ts",
"dist/plugin-sdk/extensions/qa-lab/cli.d.ts",
"dist/plugin-sdk/qa-channel.js",
"dist/plugin-sdk/qa-channel-protocol.d.ts",
"dist/qa-runtime-B9LDtssJ.js",
"docs/channels/qa-channel.md",
"docs/refactor/qa.md",
"qa/scenarios/index.md",
]),
).toEqual([
'npm package must not include private QA channel artifact "dist/extensions/qa-channel/package.json".',
'npm package must not include private QA channel artifact "dist/extensions/qa-channel/runtime-api.js".',
'npm package must not include private QA channel docs "docs/channels/qa-channel.md".',
'npm package must not include private QA channel SDK artifact "dist/plugin-sdk/qa-channel-protocol.d.ts".',
'npm package must not include private QA channel SDK artifact "dist/plugin-sdk/qa-channel.js".',
'npm package must not include private QA channel type artifact "dist/plugin-sdk/extensions/qa-channel/api.d.ts".',
'npm package must not include private QA lab artifact "dist/extensions/qa-lab/runtime-api.js".',
'npm package must not include private QA lab artifact "dist/extensions/qa-lab/src/cli.js".',
'npm package must not include private QA lab type artifact "dist/plugin-sdk/extensions/qa-lab/cli.d.ts".',
'npm package must not include private QA refactor docs "docs/refactor/qa.md".',
'npm package must not include private QA runtime chunk "dist/qa-runtime-B9LDtssJ.js".',
'npm package must not include private QA suite artifact "qa/scenarios/index.md".',
]);
@@ -380,7 +390,7 @@ describe("collectForbiddenPackedPathErrors", () => {
}
});
it("allows legacy QA compatibility paths in the generated dist inventory", () => {
it("rejects private QA paths in the generated dist inventory", () => {
const rootDir = mkdtempSync(join(tmpdir(), "openclaw-pack-inventory-"));
try {
@@ -393,7 +403,9 @@ describe("collectForbiddenPackedPathErrors", () => {
expect(
collectForbiddenPackedContentErrors([PACKAGE_DIST_INVENTORY_RELATIVE_PATH], rootDir),
).toEqual([]);
).toEqual([
'npm package must not include private QA lab marker "qa-lab/runtime-api.js" in "dist/postinstall-inventory.json".',
]);
} finally {
rmSync(rootDir, { recursive: true, force: true });
}

View File

@@ -451,19 +451,29 @@ describe("collectForbiddenPackPaths", () => {
"dist/index.js",
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
"dist/plugin-sdk/extensions/qa-channel/api.d.ts",
"dist/plugin-sdk/extensions/qa-lab/cli.d.ts",
"dist/plugin-sdk/qa-channel.js",
"dist/plugin-sdk/qa-channel-protocol.d.ts",
"dist/plugin-sdk/qa-lab.js",
"dist/plugin-sdk/qa-runtime.js",
"dist/qa-runtime-B9LDtssJ.js",
"docs/channels/qa-channel.md",
"docs/refactor/qa.md",
"qa/scenarios/index.md",
]),
).toEqual([
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
"dist/plugin-sdk/extensions/qa-channel/api.d.ts",
"dist/plugin-sdk/extensions/qa-lab/cli.d.ts",
"dist/plugin-sdk/qa-channel-protocol.d.ts",
"dist/plugin-sdk/qa-channel.js",
"dist/plugin-sdk/qa-lab.js",
"dist/plugin-sdk/qa-runtime.js",
"dist/qa-runtime-B9LDtssJ.js",
"docs/channels/qa-channel.md",
"docs/refactor/qa.md",
"qa/scenarios/index.md",
]);
});
@@ -488,7 +498,7 @@ describe("collectForbiddenPackPaths", () => {
}
});
it("allows legacy QA compatibility paths in the generated dist inventory", () => {
it("blocks private QA paths in the generated dist inventory", () => {
const tempRoot = mkdtempSync(join(tmpdir(), "openclaw-release-inventory-"));
try {
@@ -501,7 +511,7 @@ describe("collectForbiddenPackPaths", () => {
expect(
collectForbiddenPackContentPaths([PACKAGE_DIST_INVENTORY_RELATIVE_PATH], tempRoot),
).toEqual([]);
).toEqual([PACKAGE_DIST_INVENTORY_RELATIVE_PATH]);
} finally {
rmSync(tempRoot, { recursive: true, force: true });
}

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 () => {