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
-30
View File
@@ -1,30 +0,0 @@
const LEGACY_QA_CHANNEL_DIR = ["qa", "channel"].join("-");
const LEGACY_QA_LAB_DIR = ["qa", "lab"].join("-");
type NpmUpdateCompatSidecar = {
path: string;
content: string;
};
const EMPTY_RUNTIME_SIDECAR = "export {};\n";
export const NPM_UPDATE_COMPAT_SIDECARS = [
{
path: `dist/extensions/${LEGACY_QA_CHANNEL_DIR}/runtime-api.js`,
content: EMPTY_RUNTIME_SIDECAR,
},
{
path: `dist/extensions/${LEGACY_QA_LAB_DIR}/runtime-api.js`,
content: EMPTY_RUNTIME_SIDECAR,
},
] as const satisfies readonly NpmUpdateCompatSidecar[];
export const NPM_UPDATE_COMPAT_SIDECAR_PATHS = new Set<string>(
NPM_UPDATE_COMPAT_SIDECARS.map((entry) => entry.path),
);
export const NPM_UPDATE_OMITTED_BUNDLED_PLUGIN_ROOTS = new Set<string>([
`dist/extensions/${LEGACY_QA_CHANNEL_DIR}`,
`dist/extensions/${LEGACY_QA_LAB_DIR}`,
"dist/extensions/qa-matrix",
]);
+15 -4
View File
@@ -21,7 +21,6 @@ describe("package dist inventory", () => {
await expect(writePackageDistInventory(packageRoot)).resolves.toEqual([
"dist/current-BR6xv1a1.js",
"dist/extensions/qa-channel/runtime-api.js",
]);
await expect(collectPackageDistInventoryErrors(packageRoot)).resolves.toEqual([]);
@@ -65,6 +64,18 @@ describe("package dist inventory", () => {
"index.js",
);
const omittedQaLabPluginSdk = path.join(packageRoot, "dist", "plugin-sdk", "qa-lab.js");
const omittedQaChannelPluginSdk = path.join(
packageRoot,
"dist",
"plugin-sdk",
"qa-channel.js",
);
const omittedQaChannelProtocolPluginSdk = path.join(
packageRoot,
"dist",
"plugin-sdk",
"qa-channel-protocol.js",
);
const omittedQaLabTypes = path.join(
packageRoot,
"dist",
@@ -135,6 +146,8 @@ describe("package dist inventory", () => {
await fs.writeFile(omittedQaLabChunk, "export {};\n", "utf8");
await fs.writeFile(omittedQaMatrixChunk, "export {};\n", "utf8");
await fs.writeFile(omittedQaLabPluginSdk, "export {};\n", "utf8");
await fs.writeFile(omittedQaChannelPluginSdk, "export {};\n", "utf8");
await fs.writeFile(omittedQaChannelProtocolPluginSdk, "export {};\n", "utf8");
await fs.writeFile(omittedQaLabTypes, "export {};\n", "utf8");
await fs.writeFile(omittedQaRuntimeChunk, "export {};\n", "utf8");
await fs.writeFile(omittedRuntimeDepsStamp, "{}\n", "utf8");
@@ -150,9 +163,7 @@ describe("package dist inventory", () => {
);
await fs.writeFile(omittedMap, "{}", "utf8");
await expect(writePackageDistInventory(packageRoot)).resolves.toEqual([
"dist/extensions/qa-channel/runtime-api.js",
]);
await expect(writePackageDistInventory(packageRoot)).resolves.toEqual([]);
});
});
+14 -17
View File
@@ -1,24 +1,29 @@
import fs from "node:fs/promises";
import path from "node:path";
import { NPM_UPDATE_COMPAT_SIDECAR_PATHS } from "./npm-update-compat-sidecars.js";
export const PACKAGE_DIST_INVENTORY_RELATIVE_PATH = "dist/postinstall-inventory.json";
const LEGACY_QA_CHANNEL_DIR = ["qa", "channel"].join("-");
const LEGACY_QA_LAB_DIR = ["qa", "lab"].join("-");
const LEGACY_VERIFIER_COMPAT_INVENTORY_PATHS = [
`dist/extensions/${LEGACY_QA_CHANNEL_DIR}/runtime-api.js`,
];
const OMITTED_QA_EXTENSION_PREFIXES = [
`dist/extensions/${LEGACY_QA_CHANNEL_DIR}/`,
`dist/extensions/${LEGACY_QA_LAB_DIR}/`,
"dist/extensions/qa-matrix/",
];
const OMITTED_PRIVATE_QA_PLUGIN_SDK_PREFIXES = [`dist/plugin-sdk/extensions/${LEGACY_QA_LAB_DIR}/`];
const OMITTED_PRIVATE_QA_PLUGIN_SDK_PREFIXES = [
`dist/plugin-sdk/extensions/${LEGACY_QA_CHANNEL_DIR}/`,
`dist/plugin-sdk/extensions/${LEGACY_QA_LAB_DIR}/`,
];
const OMITTED_PRIVATE_QA_PLUGIN_SDK_FILES = new Set([
`dist/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}.d.ts`,
`dist/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}.js`,
`dist/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}-protocol.d.ts`,
`dist/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}-protocol.js`,
`dist/plugin-sdk/${LEGACY_QA_LAB_DIR}.d.ts`,
`dist/plugin-sdk/${LEGACY_QA_LAB_DIR}.js`,
"dist/plugin-sdk/qa-runtime.d.ts",
"dist/plugin-sdk/qa-runtime.js",
`dist/plugin-sdk/src/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}.d.ts`,
`dist/plugin-sdk/src/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}-protocol.d.ts`,
`dist/plugin-sdk/src/plugin-sdk/${LEGACY_QA_LAB_DIR}.d.ts`,
"dist/plugin-sdk/src/plugin-sdk/qa-runtime.d.ts",
]);
@@ -28,6 +33,7 @@ const OMITTED_DIST_SUBTREE_PATTERNS = [
/^dist\/extensions\/[^/]+\/node_modules(?:\/|$)/u,
/^dist\/extensions\/[^/]+\/\.openclaw-runtime-deps-[^/]+(?:\/|$)/u,
/^dist\/extensions\/qa-matrix(?:\/|$)/u,
new RegExp(`^dist/plugin-sdk/extensions/${LEGACY_QA_CHANNEL_DIR}(?:/|$)`, "u"),
new RegExp(`^dist/plugin-sdk/extensions/${LEGACY_QA_LAB_DIR}(?:/|$)`, "u"),
] as const;
const INSTALL_STAGE_DEBRIS_DIR_PATTERN = /^\.openclaw-install-stage(?:-[^/]+)?$/iu;
@@ -67,9 +73,6 @@ function isPackagedDistPath(relativePath: string): boolean {
if (relativePath === "dist/plugin-sdk/.tsbuildinfo") {
return false;
}
if (LEGACY_VERIFIER_COMPAT_INVENTORY_PATHS.includes(relativePath)) {
return true;
}
if (
OMITTED_PRIVATE_QA_PLUGIN_SDK_PREFIXES.some((prefix) => relativePath.startsWith(prefix)) ||
OMITTED_PRIVATE_QA_PLUGIN_SDK_FILES.has(relativePath) ||
@@ -219,12 +222,9 @@ export async function assertNoBundledRuntimeDepsStagingDebris(packageRoot: strin
export async function writePackageDistInventory(packageRoot: string): Promise<string[]> {
await assertNoBundledRuntimeDepsStagingDebris(packageRoot);
const inventory = [
...new Set([
...(await collectPackageDistInventory(packageRoot)),
...LEGACY_VERIFIER_COMPAT_INVENTORY_PATHS,
]),
].toSorted((left, right) => left.localeCompare(right));
const inventory = [...new Set(await collectPackageDistInventory(packageRoot))].toSorted(
(left, right) => left.localeCompare(right),
);
const inventoryPath = path.join(packageRoot, PACKAGE_DIST_INVENTORY_RELATIVE_PATH);
await fs.mkdir(path.dirname(inventoryPath), { recursive: true });
await fs.writeFile(inventoryPath, `${JSON.stringify(inventory, null, 2)}\n`, "utf8");
@@ -269,9 +269,6 @@ export async function collectPackageDistInventoryErrors(packageRoot: string): Pr
for (const relativePath of expectedFiles) {
if (!actualSet.has(relativePath)) {
if (NPM_UPDATE_COMPAT_SIDECAR_PATHS.has(relativePath)) {
continue;
}
errors.push(`missing packaged dist file ${relativePath}`);
}
}
-15
View File
@@ -5,7 +5,6 @@ import { bundledDistPluginFile } from "../../test/helpers/bundled-plugin-paths.j
import { BUNDLED_RUNTIME_SIDECAR_PATHS } from "../plugins/runtime-sidecar-paths.js";
import { withTempDir } from "../test-helpers/temp-dir.js";
import { captureEnv } from "../test-utils/env.js";
import { NPM_UPDATE_COMPAT_SIDECAR_PATHS } from "./npm-update-compat-sidecars.js";
import {
PACKAGE_DIST_INVENTORY_RELATIVE_PATH,
writePackageDistInventory,
@@ -39,14 +38,6 @@ async function writeGlobalPackageJson(packageRoot: string, version = "1.0.0") {
);
}
async function writeCompatSidecars(packageRoot: string) {
for (const relativePath of NPM_UPDATE_COMPAT_SIDECAR_PATHS) {
const absolutePath = path.join(packageRoot, relativePath);
await fs.mkdir(path.dirname(absolutePath), { recursive: true });
await fs.writeFile(absolutePath, "export {};\n", "utf-8");
}
}
async function writeBundledPluginPackageJson(
packageRoot: string,
pluginId: string,
@@ -399,7 +390,6 @@ describe("update global helpers", () => {
it("checks installed dist against the packaged inventory", async () => {
await withTempDir({ prefix: "openclaw-update-global-pkg-" }, async (packageRoot) => {
await writeGlobalPackageJson(packageRoot);
await writeCompatSidecars(packageRoot);
for (const relativePath of BUNDLED_RUNTIME_SIDECAR_PATHS) {
const absolutePath = path.join(packageRoot, relativePath);
await fs.mkdir(path.dirname(absolutePath), { recursive: true });
@@ -428,7 +418,6 @@ describe("update global helpers", () => {
it("ignores bundled plugin install stages during installed dist verification", async () => {
await withTempDir({ prefix: "openclaw-update-global-plugin-stage-" }, async (packageRoot) => {
await writeGlobalPackageJson(packageRoot);
await writeCompatSidecars(packageRoot);
await fs.mkdir(path.join(packageRoot, "dist", "extensions", "brave"), { recursive: true });
await writePackageDistInventory(packageRoot);
@@ -456,7 +445,6 @@ describe("update global helpers", () => {
it("does not require private QA sidecars when the inventory is missing", async () => {
await withTempDir({ prefix: "openclaw-update-global-legacy-" }, async (packageRoot) => {
await writeGlobalPackageJson(packageRoot);
await writeCompatSidecars(packageRoot);
await expect(collectInstalledGlobalPackageErrors({ packageRoot })).resolves.toEqual([]);
});
@@ -467,7 +455,6 @@ describe("update global helpers", () => {
{ prefix: "openclaw-update-global-missing-inventory-new-" },
async (packageRoot) => {
await writeGlobalPackageJson(packageRoot, "2026.4.15");
await writeCompatSidecars(packageRoot);
await expect(collectInstalledGlobalPackageErrors({ packageRoot })).resolves.toContain(
`missing package dist inventory ${PACKAGE_DIST_INVENTORY_RELATIVE_PATH}`,
@@ -511,7 +498,6 @@ describe("update global helpers", () => {
{ prefix: "openclaw-update-global-critical-sidecars-" },
async (packageRoot) => {
await writeGlobalPackageJson(packageRoot, "2026.4.15");
await writeCompatSidecars(packageRoot);
await writeBundledPluginPackageJson(packageRoot, "matrix", "@openclaw/matrix");
await writePackageDistInventory(packageRoot);
@@ -527,7 +513,6 @@ describe("update global helpers", () => {
{ prefix: "openclaw-update-global-stale-private-qa-" },
async (packageRoot) => {
await writeGlobalPackageJson(packageRoot, "2026.4.15");
await writeCompatSidecars(packageRoot);
await writeBundledPluginPackageJson(packageRoot, "qa-lab", "@openclaw/qa-lab");
await writePackageDistInventory(packageRoot);
+7 -19
View File
@@ -5,10 +5,6 @@ import path from "node:path";
import { BUNDLED_RUNTIME_SIDECAR_PATHS } from "../plugins/runtime-sidecar-paths.js";
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
import { pathExists } from "../utils.js";
import {
NPM_UPDATE_COMPAT_SIDECAR_PATHS,
NPM_UPDATE_OMITTED_BUNDLED_PLUGIN_ROOTS,
} from "./npm-update-compat-sidecars.js";
import {
collectPackageDistInventory,
PACKAGE_DIST_INVENTORY_RELATIVE_PATH,
@@ -46,6 +42,11 @@ const NPM_GLOBAL_INSTALL_OMIT_OPTIONAL_FLAGS = [
...NPM_GLOBAL_INSTALL_QUIET_FLAGS,
] as const;
const FIRST_PACKAGED_DIST_INVENTORY_VERSION = { major: 2026, minor: 4, patch: 15 };
const OMITTED_PRIVATE_QA_BUNDLED_PLUGIN_ROOTS = new Set([
"dist/extensions/qa-channel",
"dist/extensions/qa-lab",
"dist/extensions/qa-matrix",
]);
function normalizePackageTarget(value: string): string {
return value.trim();
@@ -187,25 +188,18 @@ async function collectInstalledPackageDistErrors(params: {
}
async function collectLegacyInstalledPackageDistPaths(packageRoot: string): Promise<string[]> {
const expectedFiles = new Set(NPM_UPDATE_COMPAT_SIDECAR_PATHS);
for (const relativePath of await collectCriticalInstalledPackageDistPaths(packageRoot)) {
expectedFiles.add(relativePath);
}
return [...expectedFiles].toSorted((left, right) => left.localeCompare(right));
return await collectCriticalInstalledPackageDistPaths(packageRoot);
}
async function collectCriticalInstalledPackageDistPaths(packageRoot: string): Promise<string[]> {
const expectedFiles = new Set<string>();
await Promise.all(
BUNDLED_RUNTIME_SIDECAR_PATHS.map(async (relativePath) => {
if (NPM_UPDATE_COMPAT_SIDECAR_PATHS.has(relativePath)) {
return;
}
const pluginRoot = resolveBundledPluginRoot(relativePath);
if (pluginRoot === null) {
return;
}
if (NPM_UPDATE_OMITTED_BUNDLED_PLUGIN_ROOTS.has(pluginRoot)) {
if (OMITTED_PRIVATE_QA_BUNDLED_PLUGIN_ROOTS.has(pluginRoot)) {
return;
}
if (
@@ -239,18 +233,12 @@ async function collectInstalledPathErrors(params: {
? actualSet.has(relativePath)
: await pathExists(path.join(params.packageRoot, relativePath));
if (!exists) {
if (NPM_UPDATE_COMPAT_SIDECAR_PATHS.has(relativePath)) {
continue;
}
errors.push(params.missingMessage(relativePath));
}
}
if (actualSet !== null && params.unexpectedMessage) {
const expectedSet = new Set(params.expectedFiles);
for (const relativePath of params.actualFiles ?? []) {
if (NPM_UPDATE_COMPAT_SIDECAR_PATHS.has(relativePath)) {
continue;
}
if (!expectedSet.has(relativePath)) {
errors.push(params.unexpectedMessage(relativePath));
}
@@ -354,6 +354,8 @@ describe("plugin-sdk subpath exports", () => {
"lobster",
"pairing-access",
"provider-model-definitions",
"qa-channel",
"qa-channel-protocol",
"reply-prefix",
"secret-input-schema",
"signal-core",