


























@@ -878,7 +878,7 @@ describe("QmdMemoryManager", () => {
878878expect(logWarnMock).toHaveBeenCalledWith(expect.stringContaining("rebinding"));
879879});
880880881-it("rebinds legacy memory-alt when it still owns the root slot for MEMORY.md", async () => {
881+it("adds canonical memory-root without treating legacy memory-alt as equivalent", async () => {
882882await fs.writeFile(path.join(workspaceDir, "MEMORY.md"), "# canonical root");
883883cfg = {
884884 ...cfg,
@@ -930,15 +930,10 @@ describe("QmdMemoryManager", () => {
930930const pathArg = args[2] ?? "";
931931const name = args[args.indexOf("--name") + 1] ?? "";
932932const pattern = args[args.indexOf("--glob") + 1] ?? args[args.indexOf("--mask") + 1] ?? "";
933-const hasConflict = [...listedCollections.entries()].some(([existingName, info]) => {
934-if (existingName === name || info.path !== pathArg) {
935-return false;
936-}
937-const isRootPatternPair =
938-(info.pattern === "MEMORY.md" || info.pattern === "memory.md") &&
939-(pattern === "MEMORY.md" || pattern === "memory.md");
940-return info.pattern === pattern || isRootPatternPair;
941-});
933+const hasConflict = [...listedCollections.entries()].some(
934+([existingName, info]) =>
935+existingName !== name && info.path === pathArg && info.pattern === pattern,
936+);
942937if (hasConflict) {
943938emitAndClose(child, "stderr", "A collection already exists for this path and pattern", 1);
944939return child;
@@ -953,10 +948,10 @@ describe("QmdMemoryManager", () => {
953948const { manager } = await createManager({ mode: "full" });
954949await manager.close();
955950956-expect(removeCalls).toContain("memory-alt");
951+expect(removeCalls).not.toContain("memory-alt");
957952expect(listedCollections.has("memory-root-main")).toBe(true);
958-expect(listedCollections.has("memory-alt")).toBe(false);
959-expect(logWarnMock).toHaveBeenCalledWith(expect.stringContaining("rebinding"));
953+expect(listedCollections.has("memory-alt")).toBe(true);
954+expect(logWarnMock).not.toHaveBeenCalledWith(expect.stringContaining("rebinding"));
960955});
961956962957it("warns instead of silently succeeding when add conflict metadata is unavailable", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。