Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/opencode/src/altimate/review/diff-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}

Expand Down
12 changes: 12 additions & 0 deletions packages/opencode/test/altimate/review-dbt-patterns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading