fix(memory-wiki): exclude durable reference pages from stale report (#94369)

Merged via squash.

Prepared head SHA: c2dca7ed9b
Co-authored-by: SunnyShu0925 <265248434+SunnyShu0925@users.noreply.github.com>
Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>
Reviewed-by: @vincentkoc
This commit is contained in:
SunnyShu0925
2026-06-23 16:19:36 +08:00
committed by GitHub
parent 32dc664b4b
commit dd76fdceb6
2 changed files with 82 additions and 0 deletions

View File

@@ -559,6 +559,85 @@ describe("compileMemoryWikiVault", () => {
);
});
it("excludes concept and synthesis pages from stale-pages report", async () => {
const { rootDir, config } = await createVault({
rootDir: nextCaseRoot(),
initialize: true,
});
await fs.writeFile(
path.join(rootDir, "entities", "entity-alpha.md"),
renderWikiMarkdown({
frontmatter: {
pageType: "entity",
id: "entity.alpha",
title: "Alpha Entity",
sourceIds: ["source.alpha"],
updatedAt: "2025-06-01T00:00:00.000Z",
},
body: "# Alpha Entity\n",
}),
"utf8",
);
await fs.writeFile(
path.join(rootDir, "sources", "source-alpha.md"),
renderWikiMarkdown({
frontmatter: {
pageType: "source",
id: "source.alpha",
title: "Alpha Source",
updatedAt: "2025-06-01T00:00:00.000Z",
},
body: "# Alpha Source\n",
}),
"utf8",
);
// Concept page with old updatedAt — should be excluded from stale-pages
await fs.writeFile(
path.join(rootDir, "concepts", "concept-beta.md"),
renderWikiMarkdown({
frontmatter: {
pageType: "concept",
id: "concept.beta",
title: "Beta Concept",
sourceIds: ["source.alpha"],
updatedAt: "2025-06-01T00:00:00.000Z",
},
body: "# Beta Concept\n",
}),
"utf8",
);
// Synthesis page with old updatedAt — should be excluded from stale-pages
await fs.writeFile(
path.join(rootDir, "syntheses", "synthesis-gamma.md"),
renderWikiMarkdown({
frontmatter: {
pageType: "synthesis",
id: "synthesis.gamma",
title: "Gamma Synthesis",
sourceIds: ["source.alpha"],
updatedAt: "2025-06-01T00:00:00.000Z",
},
body: "# Gamma Synthesis\n",
}),
"utf8",
);
await compileMemoryWikiVault(config);
const stalePages = await fs.readFile(path.join(rootDir, "reports", "stale-pages.md"), "utf8");
// Entity and source pages still appear in stale-pages
expect(stalePages).toContain("[Alpha Entity](../entities/entity-alpha.md)");
expect(stalePages).toContain("[Alpha Source](../sources/source-alpha.md)");
// Concept and synthesis pages are excluded
expect(stalePages).not.toContain("[Beta Concept](../concepts/concept-beta.md)");
expect(stalePages).not.toContain("[Gamma Synthesis](../syntheses/synthesis-gamma.md)");
});
it("skips dashboard report pages when createDashboards is disabled", async () => {
const { rootDir, config } = await createVault({
rootDir: nextCaseRoot(),

View File

@@ -214,6 +214,9 @@ const DASHBOARD_PAGES: DashboardPageDefinition[] = [
.filter(
(page) =>
page.kind !== "report" &&
// concept/synthesis are intentionally durable references
page.kind !== "concept" &&
page.kind !== "synthesis" &&
!(
isUnmanagedRawSourceSummary(page) &&
!managedImportedSourcePagePaths.has(page.relativePath)