From e46e65545176d9d01eb4e1b797470745c380387a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 26 Mar 2026 23:32:51 +0000 Subject: [PATCH] test: restore memory test seams (#55324) (thanks @joelnishanth) --- src/memory/search-manager.test.ts | 2 +- src/memory/test-manager-helpers.ts | 5 ++--- src/memory/test-manager.ts | 6 ++---- src/plugin-sdk/channel-import-guardrails.test.ts | 4 +++- src/plugin-sdk/memory-core.ts | 5 ++++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/memory/search-manager.test.ts b/src/memory/search-manager.test.ts index 082df3007fd..9c6d435bbf8 100644 --- a/src/memory/search-manager.test.ts +++ b/src/memory/search-manager.test.ts @@ -102,7 +102,7 @@ vi.mock("../../extensions/memory-core/src/memory/qmd-manager.js", () => ({ }, })); -vi.mock("./manager-runtime.js", () => ({ +vi.mock("../../extensions/memory-core/src/memory/manager-runtime.js", () => ({ MemoryIndexManager: { get: mockMemoryIndexGet, }, diff --git a/src/memory/test-manager-helpers.ts b/src/memory/test-manager-helpers.ts index 0ffe9bae822..00ea84b09b0 100644 --- a/src/memory/test-manager-helpers.ts +++ b/src/memory/test-manager-helpers.ts @@ -1,5 +1,5 @@ -import type { MemoryIndexManager } from "../../extensions/memory-core/src/memory/index.js"; import type { OpenClawConfig } from "../config/config.js"; +import type { MemoryIndexManager } from "../plugin-sdk/memory-core.js"; export async function getRequiredMemoryIndexManager(params: { cfg: OpenClawConfig; @@ -7,8 +7,7 @@ export async function getRequiredMemoryIndexManager(params: { purpose?: "default" | "status"; }): Promise { await import("./embedding.test-mocks.js"); - const { getMemorySearchManager } = - await import("../../extensions/memory-core/src/memory/index.js"); + const { getMemorySearchManager } = await import("../plugin-sdk/memory-core.js"); const result = await getMemorySearchManager({ cfg: params.cfg, agentId: params.agentId ?? "main", diff --git a/src/memory/test-manager.ts b/src/memory/test-manager.ts index e0a75f0c746..8bd28afc04b 100644 --- a/src/memory/test-manager.ts +++ b/src/memory/test-manager.ts @@ -1,8 +1,6 @@ -import { - getMemorySearchManager, - type MemoryIndexManager, -} from "../../extensions/memory-core/src/memory/index.js"; import type { OpenClawConfig } from "../config/config.js"; +import { getMemorySearchManager } from "../plugin-sdk/memory-core.js"; +import type { MemoryIndexManager } from "../plugin-sdk/memory-core.js"; export async function createMemoryManagerOrThrow( cfg: OpenClawConfig, diff --git a/src/plugin-sdk/channel-import-guardrails.test.ts b/src/plugin-sdk/channel-import-guardrails.test.ts index c81447cb724..6c2b848eb54 100644 --- a/src/plugin-sdk/channel-import-guardrails.test.ts +++ b/src/plugin-sdk/channel-import-guardrails.test.ts @@ -270,9 +270,11 @@ function collectCoreSourceFiles(): string[] { const normalizedPluginSdkDir = normalizePath(resolve(ROOT_DIR, "plugin-sdk")); coreSourceFilesCache = collectSourceFiles(coreSourceFilesCache, { rootDir: srcDir, - shouldSkipEntry: ({ normalizedFullPath }) => + shouldSkipEntry: ({ entryName, normalizedFullPath }) => normalizedFullPath.includes(".test.") || + normalizedFullPath.includes(".test-harness.") || normalizedFullPath.includes(".test-helpers.") || + entryName === "test-manager-helpers.ts" || normalizedFullPath.includes(".mock-harness.") || normalizedFullPath.includes(".suite.") || normalizedFullPath.includes(".spec.") || diff --git a/src/plugin-sdk/memory-core.ts b/src/plugin-sdk/memory-core.ts index 49ff6896a64..b422f6e2636 100644 --- a/src/plugin-sdk/memory-core.ts +++ b/src/plugin-sdk/memory-core.ts @@ -14,7 +14,10 @@ export { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js"; export { loadConfig } from "../config/config.js"; export { resolveStateDir } from "../config/paths.js"; export { resolveSessionTranscriptsDirForAgent } from "../config/sessions/paths.js"; -export { getMemorySearchManager } from "../../extensions/memory-core/src/memory/index.js"; +export { + getMemorySearchManager, + MemoryIndexManager, +} from "../../extensions/memory-core/src/memory/index.js"; export { listMemoryFiles, normalizeExtraMemoryPaths } from "../memory/internal.js"; export { readAgentMemoryFile } from "../memory/read-file.js"; export { resolveMemoryBackendConfig } from "../memory/backend-config.js";