From d1b8b21610b8f4889e02f7a7edd010fe5dfbc162 Mon Sep 17 00:00:00 2001 From: davion-knight <298846663+davion-knight@users.noreply.github.com> Date: Sat, 4 Jul 2026 21:39:24 -0500 Subject: [PATCH] feat(enrichment): classify long-form doc extensions as docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit categorizeFile (analysis-context.ts) recognized only .md/.mdx/.rst/.txt as docs, so the long-form spellings .markdown, .adoc, and .asciidoc fell through to the source category — a NOTES.markdown or guide.adoc change was treated as source rather than documentation. Add the three spellings to the docs extension list. This matches the canonical DOCS_EXTENSIONS set in src/signals/path-matchers.ts and rag.ts's DOC_EXT_RE, which already treat them as docs. Matching is case-insensitive via the existing lowercased-extension path (README.ADOC classifies as docs). --- review-enrichment/src/analysis-context.ts | 7 +++++- .../test/analysis-context.test.ts | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/review-enrichment/src/analysis-context.ts b/review-enrichment/src/analysis-context.ts index e298ecfb81..752ef5beec 100644 --- a/review-enrichment/src/analysis-context.ts +++ b/review-enrichment/src/analysis-context.ts @@ -440,7 +440,12 @@ function categorizeFile(path: string): FileCategory { ) { return { path, extension, category: "config" }; } - if ([".md", ".mdx", ".rst", ".txt"].includes(extension)) { + // Long-form doc spellings (.markdown/.adoc/.asciidoc) are docs too, matching the canonical + // DOCS_EXTENSIONS set in src/signals/path-matchers.ts and rag.ts's DOC_EXT_RE; without them a + // NOTES.markdown or guide.adoc file fell through to the source category. + if ( + [".md", ".markdown", ".mdx", ".rst", ".adoc", ".asciidoc", ".txt"].includes(extension) + ) { return { path, extension, category: "docs" }; } if ( diff --git a/review-enrichment/test/analysis-context.test.ts b/review-enrichment/test/analysis-context.test.ts index 938e3d3046..29a43aef33 100644 --- a/review-enrichment/test/analysis-context.test.ts +++ b/review-enrichment/test/analysis-context.test.ts @@ -545,6 +545,31 @@ test("createAnalysisContext classifies Zstandard archives as assets for schedule assert.deepEqual(plan.skipped.map((item) => [item.name, item.skipReason]), []); }); +test("createAnalysisContext classifies long-form doc extensions as docs", () => { + const context = createAnalysisContext({ + repoFullName: "JSONbored/gittensory", + prNumber: 3264, + files: [ + { path: "GUIDE.markdown", patch: "@@ -1,0 +1,1 @@\n+# guide" }, + { path: "docs/manual.adoc", patch: "@@ -1,0 +1,1 @@\n+= Manual" }, + { path: "docs/spec.asciidoc", patch: "@@ -1,0 +1,1 @@\n+= Spec" }, + { path: "README.ADOC", patch: "@@ -1,0 +1,1 @@\n+= Readme" }, + { path: "src/index.ts", patch: "@@ -1,0 +1,1 @@\n+export {};" }, + ], + }); + + assert.deepEqual( + context.fileCategories.map((file) => [file.path, file.category]), + [ + ["GUIDE.markdown", "docs"], + ["docs/manual.adoc", "docs"], + ["docs/spec.asciidoc", "docs"], + ["README.ADOC", "docs"], + ["src/index.ts", "source"], + ], + ); +}); + test("createAnalysisContext classifies lockfile paths case-insensitively", () => { const context = createAnalysisContext({ repoFullName: "JSONbored/gittensory",