Skip to content

Commit 0e0679b

Browse files
SunnyShu0925claude
andcommitted
[AI] test(memory-wiki): add regression test for concept/synthesis stale-pages exclusion
Verifies that concept and synthesis pages with old updatedAt are excluded from the stale-pages report, while entity and source pages still appear. Uses the real compileMemoryWikiVault path with a temporary vault. Related to #93485 Co-Authored-By: Claude <[email protected]>
1 parent ad5324b commit 0e0679b

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

extensions/memory-wiki/src/compile.test.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,85 @@ describe("compileMemoryWikiVault", () => {
559559
);
560560
});
561561

562+
it("excludes concept and synthesis pages from stale-pages report", async () => {
563+
const { rootDir, config } = await createVault({
564+
rootDir: nextCaseRoot(),
565+
initialize: true,
566+
});
567+
568+
await fs.writeFile(
569+
path.join(rootDir, "entities", "entity-alpha.md"),
570+
renderWikiMarkdown({
571+
frontmatter: {
572+
pageType: "entity",
573+
id: "entity.alpha",
574+
title: "Alpha Entity",
575+
sourceIds: ["source.alpha"],
576+
updatedAt: "2025-06-01T00:00:00.000Z",
577+
},
578+
body: "# Alpha Entity\n",
579+
}),
580+
"utf8",
581+
);
582+
583+
await fs.writeFile(
584+
path.join(rootDir, "sources", "source-alpha.md"),
585+
renderWikiMarkdown({
586+
frontmatter: {
587+
pageType: "source",
588+
id: "source.alpha",
589+
title: "Alpha Source",
590+
updatedAt: "2025-06-01T00:00:00.000Z",
591+
},
592+
body: "# Alpha Source\n",
593+
}),
594+
"utf8",
595+
);
596+
597+
// Concept page with old updatedAt — should be excluded from stale-pages
598+
await fs.writeFile(
599+
path.join(rootDir, "concepts", "concept-beta.md"),
600+
renderWikiMarkdown({
601+
frontmatter: {
602+
pageType: "concept",
603+
id: "concept.beta",
604+
title: "Beta Concept",
605+
sourceIds: ["source.alpha"],
606+
updatedAt: "2025-06-01T00:00:00.000Z",
607+
},
608+
body: "# Beta Concept\n",
609+
}),
610+
"utf8",
611+
);
612+
613+
// Synthesis page with old updatedAt — should be excluded from stale-pages
614+
await fs.writeFile(
615+
path.join(rootDir, "syntheses", "synthesis-gamma.md"),
616+
renderWikiMarkdown({
617+
frontmatter: {
618+
pageType: "synthesis",
619+
id: "synthesis.gamma",
620+
title: "Gamma Synthesis",
621+
sourceIds: ["source.alpha"],
622+
updatedAt: "2025-06-01T00:00:00.000Z",
623+
},
624+
body: "# Gamma Synthesis\n",
625+
}),
626+
"utf8",
627+
);
628+
629+
await compileMemoryWikiVault(config);
630+
631+
const stalePages = await fs.readFile(path.join(rootDir, "reports", "stale-pages.md"), "utf8");
632+
633+
// Entity and source pages still appear in stale-pages
634+
expect(stalePages).toContain("[Alpha Entity](../entities/entity-alpha.md)");
635+
expect(stalePages).toContain("[Alpha Source](../sources/source-alpha.md)");
636+
// Concept and synthesis pages are excluded
637+
expect(stalePages).not.toContain("[Beta Concept](../concepts/concept-beta.md)");
638+
expect(stalePages).not.toContain("[Gamma Synthesis](../syntheses/synthesis-gamma.md)");
639+
});
640+
562641
it("skips dashboard report pages when createDashboards is disabled", async () => {
563642
const { rootDir, config } = await createVault({
564643
rootDir: nextCaseRoot(),

0 commit comments

Comments
 (0)