mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:20:43 +00:00
refactor: stop masking legacy plugin dependency staging
This commit is contained in:
@@ -702,28 +702,19 @@ async function createMatrixQaCliGatewayRuntime(params: {
|
||||
context: MatrixQaScenarioContext;
|
||||
}) {
|
||||
const outputDir = requireMatrixQaE2eeOutputDir(params.context);
|
||||
const rootDir = await mkdtemp(
|
||||
path.join(resolvePreferredOpenClawTmpDir(), "openclaw-matrix-gateway-cli-qa-"),
|
||||
);
|
||||
const artifactDir = path.join(
|
||||
outputDir,
|
||||
params.artifactLabel,
|
||||
randomUUID().replaceAll("-", "").slice(0, 12),
|
||||
);
|
||||
const pluginStageDir = path.join(rootDir, "plugin-stage");
|
||||
await chmod(rootDir, 0o700).catch(() => undefined);
|
||||
await assertMatrixQaPrivatePathMode(rootDir, "Matrix QA CLI temp directory");
|
||||
await mkdir(artifactDir, { mode: 0o700, recursive: true });
|
||||
await chmod(artifactDir, 0o700).catch(() => undefined);
|
||||
await assertMatrixQaPrivatePathMode(artifactDir, "Matrix QA CLI artifact directory");
|
||||
await mkdir(pluginStageDir, { mode: 0o700, recursive: true });
|
||||
await chmod(pluginStageDir, 0o700).catch(() => undefined);
|
||||
const env = {
|
||||
...requireMatrixQaCliRuntimeEnv(params.context),
|
||||
FORCE_COLOR: "0",
|
||||
NO_COLOR: "1",
|
||||
OPENCLAW_DISABLE_AUTO_UPDATE: "1",
|
||||
OPENCLAW_PLUGIN_STAGE_DIR: pluginStageDir,
|
||||
};
|
||||
const run = async (args: string[], timeoutMs = params.context.timeoutMs) =>
|
||||
await runMatrixQaOpenClawCli({
|
||||
@@ -732,9 +723,7 @@ async function createMatrixQaCliGatewayRuntime(params: {
|
||||
timeoutMs,
|
||||
});
|
||||
return {
|
||||
dispose: async () => {
|
||||
await rm(rootDir, { force: true, recursive: true });
|
||||
},
|
||||
dispose: async () => undefined,
|
||||
rootDir: artifactDir,
|
||||
run,
|
||||
};
|
||||
|
||||
@@ -86,64 +86,15 @@ describe("package dist inventory", () => {
|
||||
"cli.d.ts",
|
||||
);
|
||||
const omittedQaRuntimeChunk = path.join(packageRoot, "dist", "qa-runtime-B9LDtssJ.js");
|
||||
const omittedRuntimeDepsStamp = path.join(
|
||||
packageRoot,
|
||||
"dist",
|
||||
"extensions",
|
||||
"discord",
|
||||
".openclaw-runtime-deps-stamp.json",
|
||||
);
|
||||
const [omittedBuildStamp, omittedRuntimePostBuildStamp] = LOCAL_BUILD_METADATA_DIST_PATHS.map(
|
||||
(relativePath) => path.join(packageRoot, relativePath),
|
||||
);
|
||||
const omittedRuntimeDepsTempFile = path.join(
|
||||
packageRoot,
|
||||
"dist",
|
||||
"extensions",
|
||||
"discord",
|
||||
".openclaw-runtime-deps-backup-node_modules-old",
|
||||
"left-pad",
|
||||
"index.js",
|
||||
);
|
||||
const omittedRuntimeDepsTempSymlink = path.join(
|
||||
packageRoot,
|
||||
"dist",
|
||||
"extensions",
|
||||
"amazon-bedrock",
|
||||
".openclaw-runtime-deps-copy-KZmXaz",
|
||||
"node_modules",
|
||||
".bin",
|
||||
"fxparser",
|
||||
);
|
||||
const omittedExtensionNodeModuleSymlink = path.join(
|
||||
packageRoot,
|
||||
"dist",
|
||||
"extensions",
|
||||
"discord",
|
||||
"node_modules",
|
||||
".bin",
|
||||
"color-support",
|
||||
);
|
||||
const omittedExtensionRootAliasSymlink = path.join(
|
||||
packageRoot,
|
||||
"dist",
|
||||
"extensions",
|
||||
"node_modules",
|
||||
"openclaw",
|
||||
"plugin-sdk",
|
||||
);
|
||||
const omittedMap = path.join(packageRoot, "dist", "feature.runtime.js.map");
|
||||
await fs.mkdir(path.dirname(packagedQaChannelRuntime), { recursive: true });
|
||||
await fs.mkdir(path.dirname(packagedQaLabRuntime), { recursive: true });
|
||||
await fs.mkdir(path.dirname(omittedQaMatrixChunk), { recursive: true });
|
||||
await fs.mkdir(path.dirname(omittedQaLabTypes), { recursive: true });
|
||||
await fs.mkdir(path.dirname(omittedRuntimeDepsStamp), { recursive: true });
|
||||
await fs.mkdir(path.dirname(omittedRuntimeDepsTempFile), { recursive: true });
|
||||
await fs.mkdir(path.dirname(omittedRuntimeDepsTempSymlink), { recursive: true });
|
||||
await fs.mkdir(path.dirname(omittedExtensionNodeModuleSymlink), { recursive: true });
|
||||
await fs.mkdir(path.dirname(omittedExtensionRootAliasSymlink), { recursive: true });
|
||||
await fs.mkdir(path.join(packageRoot, "dist", "plugin-sdk"), { recursive: true });
|
||||
await fs.writeFile(path.join(packageRoot, "color-support.js"), "export {};\n", "utf8");
|
||||
await fs.writeFile(packagedQaChannelRuntime, "export {};\n", "utf8");
|
||||
await fs.writeFile(packagedQaLabRuntime, "export {};\n", "utf8");
|
||||
await fs.writeFile(omittedQaChunk, "export {};\n", "utf8");
|
||||
@@ -154,26 +105,15 @@ describe("package dist inventory", () => {
|
||||
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");
|
||||
await fs.writeFile(omittedBuildStamp, "{}\n", "utf8");
|
||||
await fs.writeFile(omittedRuntimePostBuildStamp, "{}\n", "utf8");
|
||||
await fs.writeFile(omittedRuntimeDepsTempFile, "module.exports = 1;\n", "utf8");
|
||||
await fs.symlink(path.join(packageRoot, "color-support.js"), omittedRuntimeDepsTempSymlink);
|
||||
await fs.symlink(
|
||||
path.join(packageRoot, "color-support.js"),
|
||||
omittedExtensionNodeModuleSymlink,
|
||||
);
|
||||
await fs.symlink(
|
||||
path.join(packageRoot, "dist", "plugin-sdk"),
|
||||
omittedExtensionRootAliasSymlink,
|
||||
);
|
||||
await fs.writeFile(omittedMap, "{}", "utf8");
|
||||
|
||||
await expect(writePackageDistInventory(packageRoot)).resolves.toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
it("ignores runtime-created install staging dirs during installed dist verification", async () => {
|
||||
it("reports runtime-created install staging dirs during installed dist verification", async () => {
|
||||
await withTempDir({ prefix: "openclaw-dist-inventory-stage-" }, async (packageRoot) => {
|
||||
const realFile = path.join(packageRoot, "dist", "real-AbC123.js");
|
||||
await fs.mkdir(path.dirname(realFile), { recursive: true });
|
||||
@@ -207,7 +147,10 @@ describe("package dist inventory", () => {
|
||||
await fs.mkdir(path.dirname(suffixedStageFile), { recursive: true });
|
||||
await fs.writeFile(suffixedStageFile, "{}", "utf8");
|
||||
|
||||
await expect(collectPackageDistInventoryErrors(packageRoot)).resolves.toEqual([]);
|
||||
await expect(collectPackageDistInventoryErrors(packageRoot)).resolves.toEqual([
|
||||
"unexpected packaged dist file dist/extensions/brave/.openclaw-install-stage/node_modules/typebox/build/compile/code.mjs",
|
||||
"unexpected packaged dist file dist/extensions/browser/.openclaw-install-stage-AbC123/node_modules/playwright-core/package.json",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ const OMITTED_PRIVATE_QA_PLUGIN_SDK_FILES = new Set([
|
||||
]);
|
||||
const OMITTED_PRIVATE_QA_DIST_PREFIXES = ["dist/qa-runtime-"];
|
||||
const OMITTED_DIST_SUBTREE_PATTERNS = [
|
||||
/^dist\/extensions\/node_modules(?:\/|$)/u,
|
||||
/^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"),
|
||||
@@ -70,9 +67,6 @@ function isPackagedDistPath(relativePath: string): boolean {
|
||||
if (isLocalBuildMetadataDistPath(relativePath)) {
|
||||
return false;
|
||||
}
|
||||
if (relativePath.endsWith("/.openclaw-runtime-deps-stamp.json")) {
|
||||
return false;
|
||||
}
|
||||
if (relativePath.endsWith(".map")) {
|
||||
return false;
|
||||
}
|
||||
@@ -93,10 +87,7 @@ function isPackagedDistPath(relativePath: string): boolean {
|
||||
}
|
||||
|
||||
function isOmittedDistSubtree(relativePath: string): boolean {
|
||||
return (
|
||||
isLegacyPluginDependencyInstallStagePath(relativePath) ||
|
||||
OMITTED_DIST_SUBTREE_PATTERNS.some((pattern) => pattern.test(relativePath))
|
||||
);
|
||||
return OMITTED_DIST_SUBTREE_PATTERNS.some((pattern) => pattern.test(relativePath));
|
||||
}
|
||||
|
||||
async function collectRelativeFiles(rootDir: string, baseDir: string): Promise<string[]> {
|
||||
|
||||
@@ -457,7 +457,7 @@ describe("update global helpers", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("ignores bundled plugin install stages during installed dist verification", async () => {
|
||||
it("reports bundled plugin install stages during installed dist verification", async () => {
|
||||
await withTempDir({ prefix: "openclaw-update-global-plugin-stage-" }, async (packageRoot) => {
|
||||
await writeGlobalPackageJson(packageRoot);
|
||||
await fs.mkdir(path.join(packageRoot, "dist", "extensions", "brave"), { recursive: true });
|
||||
@@ -480,7 +480,10 @@ describe("update global helpers", () => {
|
||||
await fs.writeFile(stagedFile, "export {};\n", "utf8");
|
||||
}
|
||||
|
||||
await expect(collectInstalledGlobalPackageErrors({ packageRoot })).resolves.toEqual([]);
|
||||
await expect(collectInstalledGlobalPackageErrors({ packageRoot })).resolves.toEqual([
|
||||
"unexpected packaged dist file dist/extensions/brave/.openclaw-install-stage-retry/node_modules/typebox/build/compile/code.mjs",
|
||||
"unexpected packaged dist file dist/extensions/brave/.openclaw-install-stage/node_modules/typebox/build/compile/code.mjs",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user