fix: stop generating qa npm sidecars

This commit is contained in:
Peter Steinberger
2026-04-22 23:10:53 +01:00
parent f66098f8f6
commit a32a6c2f89
10 changed files with 15 additions and 119 deletions

View File

@@ -1243,7 +1243,7 @@
"audit:seams": "node scripts/audit-seams.mjs",
"build": "node scripts/build-all.mjs",
"build:ci-artifacts": "node scripts/build-all.mjs ciArtifacts",
"build:docker": "node scripts/tsdown-build.mjs && node scripts/runtime-postbuild.mjs && node --import tsx scripts/write-npm-update-compat-sidecars.ts && node scripts/build-stamp.mjs && node --import tsx scripts/canvas-a2ui-copy.ts && node --import tsx scripts/copy-hook-metadata.ts && node --import tsx scripts/copy-export-html-templates.ts && node --import tsx scripts/write-build-info.ts && node --experimental-strip-types scripts/write-cli-startup-metadata.ts && node --import tsx scripts/write-cli-compat.ts",
"build:docker": "node scripts/tsdown-build.mjs && node scripts/runtime-postbuild.mjs && node scripts/build-stamp.mjs && node --import tsx scripts/canvas-a2ui-copy.ts && node --import tsx scripts/copy-hook-metadata.ts && node --import tsx scripts/copy-export-html-templates.ts && node --import tsx scripts/write-build-info.ts && node --experimental-strip-types scripts/write-cli-startup-metadata.ts && node --import tsx scripts/write-cli-compat.ts",
"build:plugin-sdk:dts": "tsgo -p tsconfig.plugin-sdk.dts.json",
"build:strict-smoke": "pnpm canvas:a2ui:bundle && node scripts/tsdown-build.mjs && node scripts/runtime-postbuild.mjs && node scripts/build-stamp.mjs && pnpm build:plugin-sdk:dts && node --import tsx scripts/write-plugin-sdk-entry-dts.ts && node scripts/check-plugin-sdk-exports.mjs",
"canon:check": "node scripts/canon.mjs check",

View File

@@ -14,21 +14,6 @@ export const BUILD_ALL_STEPS = [
{ label: "canvas:a2ui:bundle", kind: "pnpm", pnpmArgs: ["canvas:a2ui:bundle"] },
{ label: "tsdown", kind: "node", args: ["scripts/tsdown-build.mjs"] },
{ label: "runtime-postbuild", kind: "node", args: ["scripts/runtime-postbuild.mjs"] },
{
label: "write-npm-update-compat-sidecars",
kind: "node",
args: ["--import", "tsx", "scripts/write-npm-update-compat-sidecars.ts"],
cache: {
inputs: [
"scripts/write-npm-update-compat-sidecars.ts",
"src/infra/npm-update-compat-sidecars.ts",
],
outputs: [
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
],
},
},
{ label: "build-stamp", kind: "node", args: ["scripts/build-stamp.mjs"] },
{
label: "build:plugin-sdk:dts",
@@ -107,7 +92,6 @@ export const BUILD_ALL_PROFILES = {
"canvas:a2ui:bundle",
"tsdown",
"runtime-postbuild",
"write-npm-update-compat-sidecars",
"build-stamp",
"canvas-a2ui-copy",
"copy-hook-metadata",

View File

@@ -51,7 +51,6 @@ parallels_package_run_with_build_lock() {
}
parallels_package_write_dist_inventory() {
node --import tsx scripts/write-npm-update-compat-sidecars.ts
node --import tsx --input-type=module --eval \
'import { writePackageDistInventory } from "./src/infra/package-dist-inventory.ts"; await writePackageDistInventory(process.cwd());'
}

View File

@@ -44,16 +44,9 @@ type InstalledBundledExtensionManifestRecord = {
const MAX_BUNDLED_EXTENSION_MANIFEST_BYTES = 1024 * 1024;
const LEGACY_CONTEXT_ENGINE_UNRESOLVED_RUNTIME_MARKER =
"Failed to load legacy context engine runtime.";
const LEGACY_UPDATE_COMPAT_RUNTIME_SIDECAR_PATHS = [
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
] as const;
const PUBLISHED_BUNDLED_RUNTIME_SIDECAR_PATHS = [
...BUNDLED_RUNTIME_SIDECAR_PATHS.filter((relativePath) =>
listBundledPluginPackArtifacts().includes(relativePath),
),
...LEGACY_UPDATE_COMPAT_RUNTIME_SIDECAR_PATHS,
] as const;
const PUBLISHED_BUNDLED_RUNTIME_SIDECAR_PATHS = BUNDLED_RUNTIME_SIDECAR_PATHS.filter(
(relativePath) => listBundledPluginPackArtifacts().includes(relativePath),
);
export type PublishedInstallScenario = {
name: string;

View File

@@ -34,20 +34,7 @@ const DEFAULT_PACKAGE_ROOT = join(__dirname, "..");
const DISABLE_POSTINSTALL_ENV = "OPENCLAW_DISABLE_BUNDLED_PLUGIN_POSTINSTALL";
const EAGER_BUNDLED_PLUGIN_DEPS_ENV = "OPENCLAW_EAGER_BUNDLED_PLUGIN_DEPS";
const DIST_INVENTORY_PATH = "dist/postinstall-inventory.json";
const LEGACY_UPDATE_COMPAT_SIDECARS = [
{
path: "dist/extensions/qa-channel/runtime-api.js",
removedPrefix: "dist/extensions/qa-channel/",
content:
"// Compatibility stub for older OpenClaw updaters. The QA channel implementation is not packaged.\nexport {};\n",
},
{
path: "dist/extensions/qa-lab/runtime-api.js",
removedPrefix: "dist/extensions/qa-lab/",
content:
"// Compatibility stub for older OpenClaw updaters. The QA lab implementation is not packaged.\nexport {};\n",
},
];
const LEGACY_UPDATE_COMPAT_SIDECARS = [];
const BAILEYS_MEDIA_FILE = join(
"node_modules",
"@whiskeysockets",

View File

@@ -1,17 +1,11 @@
const LEGACY_QA_LAB_DIR = ["qa", "lab"].join("-");
export const NPM_UPDATE_COMPAT_SIDECARS = [
{
path: "dist/extensions/qa-channel/runtime-api.js",
content:
"// Compatibility stub for older OpenClaw updaters. The QA channel implementation is not packaged.\nexport {};\n",
},
{
path: `dist/extensions/${LEGACY_QA_LAB_DIR}/runtime-api.js`,
content:
"// Compatibility stub for older OpenClaw updaters. The QA lab implementation is not packaged.\nexport {};\n",
},
] as const;
type NpmUpdateCompatSidecar = {
path: string;
content: string;
};
export const NPM_UPDATE_COMPAT_SIDECARS = [] as readonly NpmUpdateCompatSidecar[];
export const NPM_UPDATE_COMPAT_SIDECAR_PATHS = new Set<string>(
NPM_UPDATE_COMPAT_SIDECARS.map((entry) => entry.path),

View File

@@ -31,9 +31,6 @@ import {
} from "./update-global.js";
const MATRIX_HELPER_API = bundledDistPluginFile("matrix", "helper-api.js");
const QA_CHANNEL_RUNTIME_API = bundledDistPluginFile("qa-channel", "runtime-api.js");
const QA_LAB_RUNTIME_API = bundledDistPluginFile("qa-lab", "runtime-api.js");
async function writeGlobalPackageJson(packageRoot: string, version = "1.0.0") {
await fs.writeFile(
path.join(packageRoot, "package.json"),
@@ -428,23 +425,12 @@ describe("update global helpers", () => {
});
});
it("falls back to legacy sidecar verification when the inventory is missing", async () => {
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([]);
await fs.rm(path.join(packageRoot, QA_CHANNEL_RUNTIME_API));
await expect(collectInstalledGlobalPackageErrors({ packageRoot })).resolves.toContain(
`missing bundled runtime sidecar ${QA_CHANNEL_RUNTIME_API}`,
);
await fs.writeFile(path.join(packageRoot, QA_CHANNEL_RUNTIME_API), "export {};\n", "utf-8");
await fs.rm(path.join(packageRoot, QA_LAB_RUNTIME_API));
await expect(collectInstalledGlobalPackageErrors({ packageRoot })).resolves.toContain(
`missing bundled runtime sidecar ${QA_LAB_RUNTIME_API}`,
);
});
});

View File

@@ -17,12 +17,8 @@ import { BUNDLED_RUNTIME_SIDECAR_PATHS } from "../src/plugins/runtime-sidecar-pa
const PUBLISHED_BUNDLED_RUNTIME_SIDECAR_PATHS = BUNDLED_RUNTIME_SIDECAR_PATHS.filter(
(relativePath) => listBundledPluginPackArtifacts().includes(relativePath),
);
const LEGACY_UPDATE_COMPAT_RUNTIME_SIDECAR_PATHS = [
"dist/extensions/qa-channel/runtime-api.js",
] as const;
const REQUIRED_INSTALLED_RUNTIME_SIDECAR_PATHS = [
...PUBLISHED_BUNDLED_RUNTIME_SIDECAR_PATHS,
...LEGACY_UPDATE_COMPAT_RUNTIME_SIDECAR_PATHS,
] as const;
describe("buildPublishedInstallScenarios", () => {

View File

@@ -132,7 +132,6 @@ describe("resolveBuildAllSteps", () => {
"canvas:a2ui:bundle",
"tsdown",
"runtime-postbuild",
"write-npm-update-compat-sidecars",
"build-stamp",
"canvas-a2ui-copy",
"copy-hook-metadata",

View File

@@ -9,7 +9,6 @@ import {
pruneInstalledPackageDist,
discoverBundledPluginRuntimeDeps,
pruneBundledPluginSourceNodeModules,
restoreLegacyUpdaterCompatSidecars,
runBundledPluginPostinstall,
} from "../../scripts/postinstall-bundled-plugins.mjs";
import { writePackageDistInventory } from "../../src/infra/package-dist-inventory.ts";
@@ -292,46 +291,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"),
"utf8",
),
).resolves.toContain("QA channel implementation is not packaged");
await expect(
fs.readFile(path.join(packageRoot, "dist", "extensions", "qa-lab", "runtime-api.js"), "utf8"),
).resolves.toContain("QA lab implementation is not packaged");
});
it("creates only empty QA compat sidecars for fresh installs", async () => {
const packageRoot = await createTempDirAsync("openclaw-packaged-install-no-qa-compat-");
await fs.mkdir(path.join(packageRoot, "dist"), { recursive: true });
await fs.writeFile(path.join(packageRoot, "dist", "entry.js"), "export {};\n");
await writePackageDistInventory(packageRoot);
expect(
restoreLegacyUpdaterCompatSidecars({
packageRoot,
removedFiles: ["dist/entry-old.js"],
log: { log: vi.fn(), warn: vi.fn() },
}),
).toEqual([
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
]);
await expect(
fs.readFile(
path.join(packageRoot, "dist", "extensions", "qa-channel", "runtime-api.js"),
"utf8",
),
).resolves.toBe(
"// Compatibility stub for older OpenClaw updaters. The QA channel implementation is not packaged.\nexport {};\n",
);
await expect(
fs.readFile(path.join(packageRoot, "dist", "extensions", "qa-lab", "runtime-api.js"), "utf8"),
).resolves.toBe(
"// Compatibility stub for older OpenClaw updaters. The QA lab implementation is not packaged.\nexport {};\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" });
@@ -339,10 +300,7 @@ describe("bundled plugin postinstall", () => {
fs.stat(path.join(packageRoot, "dist", "extensions", "qa-channel", "openclaw.plugin.json")),
).rejects.toMatchObject({ code: "ENOENT" });
await expect(
fs.stat(path.join(packageRoot, "dist", "extensions", "qa-lab", "package.json")),
).rejects.toMatchObject({ code: "ENOENT" });
await expect(
fs.stat(path.join(packageRoot, "dist", "extensions", "qa-lab", "openclaw.plugin.json")),
fs.stat(path.join(packageRoot, "dist", "extensions", "qa-lab", "runtime-api.js")),
).rejects.toMatchObject({ code: "ENOENT" });
});