diff --git a/packages/opencode/src/altimate/review/diff-filter.ts b/packages/opencode/src/altimate/review/diff-filter.ts index 7ba60b2a6..234c04c29 100644 --- a/packages/opencode/src/altimate/review/diff-filter.ts +++ b/packages/opencode/src/altimate/review/diff-filter.ts @@ -58,6 +58,7 @@ export type DbtFileKind = /** Classify a changed file by its role in a dbt project. */ export function classifyDbtFile(path: string): DbtFileKind { const p = path.replace(/\\/g, "/").toLowerCase() + const isYaml = p.endsWith(".yml") || p.endsWith(".yaml") if (/(^|\/)(dbt_project|profiles|packages|dependencies)\.ya?ml$/.test(p)) return "project_config" if (/(^|\/)macros\//.test(p)) return "macro" if (/(^|\/)snapshots\//.test(p)) return "snapshot" @@ -66,7 +67,8 @@ export function classifyDbtFile(path: string): DbtFileKind { if (/(^|\/)analyses\//.test(p)) return "analysis" if (/(^|\/)models\//.test(p) && p.endsWith(".py")) return "python_model" if (/(^|\/)models\//.test(p) && p.endsWith(".sql")) return "model_sql" - if (p.endsWith(".yml") || p.endsWith(".yaml")) return "schema_yml" + if (isYaml && /(^|\/)(models|snapshots|seeds|tests)\//.test(p)) return "schema_yml" + if (isYaml && /(^|\/)(_?schema|_?models|_?sources|sources|properties)\.ya?ml$/.test(p)) return "schema_yml" return "other" } diff --git a/packages/opencode/test/altimate/review-dbt-patterns.test.ts b/packages/opencode/test/altimate/review-dbt-patterns.test.ts index 427333450..9fbbae2b9 100644 --- a/packages/opencode/test/altimate/review-dbt-patterns.test.ts +++ b/packages/opencode/test/altimate/review-dbt-patterns.test.ts @@ -146,6 +146,18 @@ describe("dbt-patterns detectors", () => { expect(has(f, "test_coverage")).toBe(true) }) + test("workflow YAML is not treated as schema.yml", () => { + const f = detectSchemaYmlPatterns( + { + path: ".github/workflows/dbt-pr-review.yml", + status: "modified", + diff: "- - name: order_id\n- description: One row per order", + }, + DEFAULT_RUBRIC, + ) + expect(f.length).toBe(0) + }) + test("benign additive column produces NO dbt-pattern finding (precision)", () => { const sql = `select id, upper(status) as status_upper from {{ ref('x') }}` const f = detectModelPatterns(