From a32a6c2f89dacda357e56bb540aab65314b95f86 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 22 Apr 2026 23:10:53 +0100 Subject: [PATCH] fix: stop generating qa npm sidecars --- package.json | 2 +- scripts/build-all.mjs | 16 ------- scripts/e2e/lib/parallels-package-common.sh | 1 - scripts/openclaw-npm-postpublish-verify.ts | 13 ++--- scripts/postinstall-bundled-plugins.mjs | 15 +----- src/infra/npm-update-compat-sidecars.ts | 18 +++---- src/infra/update-global.test.ts | 16 +------ test/openclaw-npm-postpublish-verify.test.ts | 4 -- test/scripts/build-all.test.ts | 1 - .../postinstall-bundled-plugins.test.ts | 48 ++----------------- 10 files changed, 15 insertions(+), 119 deletions(-) diff --git a/package.json b/package.json index 9ccd84a84dd..a607c84db6b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/build-all.mjs b/scripts/build-all.mjs index 50f436dec57..e1c07d8c607 100644 --- a/scripts/build-all.mjs +++ b/scripts/build-all.mjs @@ -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", diff --git a/scripts/e2e/lib/parallels-package-common.sh b/scripts/e2e/lib/parallels-package-common.sh index 84141d6a89a..516effd8909 100644 --- a/scripts/e2e/lib/parallels-package-common.sh +++ b/scripts/e2e/lib/parallels-package-common.sh @@ -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());' } diff --git a/scripts/openclaw-npm-postpublish-verify.ts b/scripts/openclaw-npm-postpublish-verify.ts index 4da0d7caed9..a74dc7390ae 100644 --- a/scripts/openclaw-npm-postpublish-verify.ts +++ b/scripts/openclaw-npm-postpublish-verify.ts @@ -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; diff --git a/scripts/postinstall-bundled-plugins.mjs b/scripts/postinstall-bundled-plugins.mjs index 523a66989d1..3b7b51bbb14 100644 --- a/scripts/postinstall-bundled-plugins.mjs +++ b/scripts/postinstall-bundled-plugins.mjs @@ -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", diff --git a/src/infra/npm-update-compat-sidecars.ts b/src/infra/npm-update-compat-sidecars.ts index 6a866c0c8ca..a378fc5270c 100644 --- a/src/infra/npm-update-compat-sidecars.ts +++ b/src/infra/npm-update-compat-sidecars.ts @@ -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( NPM_UPDATE_COMPAT_SIDECARS.map((entry) => entry.path), diff --git a/src/infra/update-global.test.ts b/src/infra/update-global.test.ts index 495a0b117aa..436a0c9bdbe 100644 --- a/src/infra/update-global.test.ts +++ b/src/infra/update-global.test.ts @@ -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}`, - ); }); }); diff --git a/test/openclaw-npm-postpublish-verify.test.ts b/test/openclaw-npm-postpublish-verify.test.ts index 59a27521427..0f6ae2183e8 100644 --- a/test/openclaw-npm-postpublish-verify.test.ts +++ b/test/openclaw-npm-postpublish-verify.test.ts @@ -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", () => { diff --git a/test/scripts/build-all.test.ts b/test/scripts/build-all.test.ts index 4e2d50dacfa..d6de16b3609 100644 --- a/test/scripts/build-all.test.ts +++ b/test/scripts/build-all.test.ts @@ -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", diff --git a/test/scripts/postinstall-bundled-plugins.test.ts b/test/scripts/postinstall-bundled-plugins.test.ts index 252b5261f0f..4cf5dea3ba9 100644 --- a/test/scripts/postinstall-bundled-plugins.test.ts +++ b/test/scripts/postinstall-bundled-plugins.test.ts @@ -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" }); });