feat(FN-3207): remove runtime memory-backend side-load

Merged FN-3207 and FN-3242: streamlined the memory backend by removing the runtime side-load pattern in `project-memory.ts` (simplified from 25+ lines), added regression tests across core, engine, and CLI bundle to catch the import issue at build time, and updated ChatView with a CSS fix for file me

Fusion-Task-Id: FN-3207
This commit is contained in:
Fusion
2026-05-03 07:18:52 -07:00
committed by gsxdsm
parent fa16b953c0
commit a82c3dcac7
5 changed files with 86 additions and 21 deletions

View File

@@ -13,6 +13,7 @@ import {
readProjectMemory,
readProjectMemoryWithBackend,
searchProjectMemory,
getProjectMemory,
resolveMemoryInstructionContext,
} from "../project-memory.js";
@@ -649,4 +650,45 @@ describe("project-memory", () => {
expect(results.some((result) => result.path === ".fusion/memory/DREAMS.md")).toBe(true);
});
});
describe("getProjectMemory", () => {
it("reads bounded memory window via file backend", async () => {
const memoryDir = join(testDir, ".fusion", "memory");
await mkdir(memoryDir, { recursive: true });
await writeFile(
join(memoryDir, "MEMORY.md"),
"# Memory\nline-a\nline-b\nline-c\nline-d\n",
"utf-8",
);
const result = await getProjectMemory(
testDir,
{ path: ".fusion/memory/MEMORY.md", startLine: 2, lineCount: 2 },
{ memoryBackendType: "file" },
);
expect(result.path).toBe(".fusion/memory/MEMORY.md");
expect(result.content).toBe("line-a\nline-b");
expect(result.startLine).toBe(2);
expect(result.endLine).toBe(3);
expect(result.totalLines).toBeGreaterThanOrEqual(5);
expect(result.backend).toBe("file");
});
it("returns qmd backend marker for memory_get contract", async () => {
const memoryDir = join(testDir, ".fusion", "memory");
await mkdir(memoryDir, { recursive: true });
await writeFile(join(memoryDir, "MEMORY.md"), "# Memory\nqmd-line\n", "utf-8");
const result = await getProjectMemory(
testDir,
{ path: ".fusion/memory/MEMORY.md", startLine: 1, lineCount: 5 },
{ memoryBackendType: "qmd" },
);
expect(result.path).toBe(".fusion/memory/MEMORY.md");
expect(result.content).toContain("qmd-line");
expect(result.backend).toBe("qmd");
});
});
});