






















@@ -395,7 +395,9 @@ describe("bundled plugin postinstall", () => {
395395});
396396397397it("prunes legacy plugin runtime deps state during packaged postinstall", async () => {
398-const packageRoot = await createTempDirAsync("openclaw-packaged-state-cleanup-");
398+const prefix = await createTempDirAsync("openclaw-packaged-prefix-");
399+const packageRoot = path.join(prefix, "lib", "node_modules", "openclaw");
400+const nodeModulesRoot = path.dirname(packageRoot);
399401const home = await createTempDirAsync("openclaw-packaged-home-");
400402const stateOverride = path.join(home, "custom-state");
401403const systemState = path.join(home, "system-state");
@@ -411,6 +413,15 @@ describe("bundled plugin postinstall", () => {
411413"node_modules",
412414);
413415const currentFile = path.join(packageRoot, "dist", "entry.js");
416+const legacySymlinkTarget = path.join(
417+defaultLegacyRoot,
418+"openclaw-2026.4.29-slack",
419+"node_modules",
420+"@slack",
421+"web-api",
422+);
423+const slackScope = path.join(nodeModulesRoot, "@slack");
424+const legacySymlink = path.join(slackScope, "web-api");
414425415426await fs.mkdir(path.dirname(currentFile), { recursive: true });
416427await fs.writeFile(currentFile, "export {};\n");
@@ -425,6 +436,9 @@ describe("bundled plugin postinstall", () => {
425436await fs.mkdir(root, { recursive: true });
426437await fs.writeFile(path.join(root, "package.json"), "{}\n");
427438}
439+await fs.mkdir(legacySymlinkTarget, { recursive: true });
440+await fs.mkdir(slackScope, { recursive: true });
441+await fs.symlink(legacySymlinkTarget, legacySymlink, "dir");
428442429443const log = { log: vi.fn(), warn: vi.fn() };
430444runBundledPluginPostinstall({
@@ -441,6 +455,7 @@ describe("bundled plugin postinstall", () => {
441455await expect(fs.stat(oldBrandLegacyRoot)).rejects.toMatchObject({ code: "ENOENT" });
442456await expect(fs.stat(overrideLegacyRoot)).rejects.toMatchObject({ code: "ENOENT" });
443457await expect(fs.stat(systemLegacyRoot)).rejects.toMatchObject({ code: "ENOENT" });
458+await expect(fs.lstat(legacySymlink)).rejects.toMatchObject({ code: "ENOENT" });
444459await expect(fs.stat(thirdPartyNodeModules)).resolves.toBeTruthy();
445460expect(log.warn).not.toHaveBeenCalled();
446461expect(log.log).toHaveBeenCalledWith(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。