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",