Packaging: remove QA compat sidecars

This commit is contained in:
Gustavo Madeira Santana
2026-04-14 15:29:38 -04:00
parent 32be17df79
commit 27241bd089
8 changed files with 7 additions and 58 deletions

View File

@@ -30,7 +30,6 @@
"!dist/**/*.map",
"!dist/plugin-sdk/.tsbuildinfo",
"!dist/extensions/qa-channel/**",
"dist/extensions/qa-channel/runtime-api.js",
"!dist/extensions/qa-lab/**",
"!dist/extensions/qa-matrix/**",
"docs/",

View File

@@ -10,11 +10,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: ["scripts/write-npm-update-compat-sidecars.mjs"],
},
{ label: "build-stamp", kind: "node", args: ["scripts/build-stamp.mjs"] },
{
label: "build:plugin-sdk:dts",

View File

@@ -1,11 +0,0 @@
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",
},
];
export const NPM_UPDATE_COMPAT_SIDECAR_PATHS = new Set(
NPM_UPDATE_COMPAT_SIDECARS.map((entry) => entry.path),
);

View File

@@ -20,7 +20,6 @@ import {
collectRootDistBundledRuntimeMirrors,
collectRuntimeDependencySpecs,
} from "./lib/bundled-plugin-root-runtime-mirrors.mjs";
import { NPM_UPDATE_COMPAT_SIDECAR_PATHS } from "./lib/npm-update-compat-sidecars.mjs";
import { runInstalledWorkspaceBootstrapSmoke } from "./lib/workspace-bootstrap-smoke.mjs";
import { parseReleaseVersion, resolveNpmCommandInvocation } from "./openclaw-npm-release-check.ts";
@@ -44,13 +43,6 @@ 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 NPM_UPDATE_COMPAT_EXTENSION_DIRS = new Set(
[...NPM_UPDATE_COMPAT_SIDECAR_PATHS].map((relativePath) => {
const pathParts = relativePath.split("/");
pathParts.pop();
return pathParts.join("/");
}),
);
export type PublishedInstallScenario = {
name: string;
@@ -183,20 +175,6 @@ function collectExpectedBundledExtensionPackageIds(
return ids;
}
function isNpmUpdateCompatOnlyExtensionDir(params: {
extensionId: string;
packageRoot: string;
}): boolean {
const relativeExtensionDir = `dist/extensions/${params.extensionId}`;
if (!NPM_UPDATE_COMPAT_EXTENSION_DIRS.has(relativeExtensionDir)) {
return false;
}
return [...NPM_UPDATE_COMPAT_SIDECAR_PATHS]
.filter((relativePath) => relativePath.startsWith(`${relativeExtensionDir}/`))
.every((relativePath) => existsSync(join(params.packageRoot, relativePath)));
}
function readBundledExtensionPackageJsons(packageRoot: string): {
manifests: InstalledBundledExtensionManifestRecord[];
errors: string[];
@@ -218,9 +196,6 @@ function readBundledExtensionPackageJsons(packageRoot: string): {
const extensionDirPath = join(extensionsDir, entry.name);
const packageJsonPath = join(extensionsDir, entry.name, "package.json");
if (!existsSync(packageJsonPath)) {
if (isNpmUpdateCompatOnlyExtensionDir({ extensionId: entry.name, packageRoot })) {
continue;
}
if (expectedPackageIds === null || expectedPackageIds.has(entry.name)) {
errors.push(`installed bundled extension manifest missing: ${packageJsonPath}.`);
}

View File

@@ -9,7 +9,6 @@ import {
resolveNpmDistTagMirrorAuth as resolveNpmDistTagMirrorAuthBase,
parseReleaseVersion as parseReleaseVersionBase,
} from "./lib/npm-publish-plan.mjs";
import { NPM_UPDATE_COMPAT_SIDECAR_PATHS } from "./lib/npm-update-compat-sidecars.mjs";
import { WORKSPACE_TEMPLATE_PACK_PATHS } from "./lib/workspace-bootstrap-smoke.mjs";
type PackageJson = {
@@ -465,9 +464,6 @@ function collectPackedTarballErrors(): string[] {
export function collectForbiddenPackedPathErrors(paths: Iterable<string>): string[] {
const errors: string[] = [];
for (const packedPath of paths) {
if (NPM_UPDATE_COMPAT_SIDECAR_PATHS.has(packedPath)) {
continue;
}
const matchedRule = FORBIDDEN_PACKED_PATH_RULES.find((rule) =>
packedPath.startsWith(rule.prefix),
);

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env node
import fs from "node:fs";
import path from "node:path";
import { NPM_UPDATE_COMPAT_SIDECARS } from "./lib/npm-update-compat-sidecars.mjs";
for (const entry of NPM_UPDATE_COMPAT_SIDECARS) {
fs.mkdirSync(path.dirname(entry.path), { recursive: true });
fs.writeFileSync(entry.path, entry.content, "utf8");
}

View File

@@ -301,7 +301,7 @@ describe("collectInstalledMirroredRootDependencyManifestErrors", () => {
}
});
it("allows npm update compatibility sidecar directories without package.json", () => {
it("rejects private qa sidecar directories that are missing package.json", () => {
const packageRoot = makeInstalledPackageRoot();
try {
@@ -322,7 +322,10 @@ describe("collectInstalledMirroredRootDependencyManifestErrors", () => {
"utf8",
);
expect(collectInstalledMirroredRootDependencyManifestErrors(packageRoot)).toEqual([]);
expect(collectInstalledMirroredRootDependencyManifestErrors(packageRoot)).toEqual([
`installed bundled extension manifest missing: ${join(packageRoot, "dist/extensions/qa-channel/package.json")}.`,
`installed bundled extension manifest missing: ${join(packageRoot, "dist/extensions/qa-lab/package.json")}.`,
]);
} finally {
rmSync(packageRoot, { recursive: true, force: true });
}

View File

@@ -325,6 +325,8 @@ describe("collectForbiddenPackedPathErrors", () => {
]),
).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 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".',
]);
});