Skip to content

Commit 9848113

Browse files
anandgupta42claude
andcommitted
fix: don't render empty mermaid graph when only test nodes downstream
When all downstream nodes are dbt tests (not_null, unique, etc.), the filter removed them all, leaving an empty mermaid graph that GitHub renders as nothing. Now shows a text impact summary instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a706430 commit 9848113

3 files changed

Lines changed: 27 additions & 7 deletions

File tree

dist/index.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24186,10 +24186,19 @@ function buildComment(report) {
2418624186
sections.push("");
2418724187
}
2418824188
if (report.impact && report.impact.modifiedModels.length > 0) {
24189-
const totalDownstream = report.impact.downstreamModels.length + report.impact.affectedExposures.length;
24190-
if (totalDownstream > 0) {
24189+
const filteredDownstream = report.impact.downstreamModels.filter(
24190+
(d) => !/^(not_null|unique|accepted_values|relationships|dbt_utils|dbt_expectations)_/.test(d)
24191+
);
24192+
const visibleNodes = filteredDownstream.length + report.impact.affectedExposures.length;
24193+
const testCount = report.impact.downstreamModels.length - filteredDownstream.length;
24194+
if (visibleNodes > 0) {
2419124195
sections.push(buildMermaidDAG(report.impact));
2419224196
sections.push("");
24197+
} else if (testCount > 0) {
24198+
sections.push(
24199+
`### \u{1F4CA} Impact \u2014 ${report.impact.modifiedModels.join(", ")} (\u{1F9EA} ${testCount} tests depend on this model)`
24200+
);
24201+
sections.push("");
2419324202
}
2419424203
}
2419524204
if (report.issues.length > 0) {

dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/reporting/comment.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,22 @@ export function buildComment(report: ReviewReport): string | null {
5555

5656
// Section 4: Mermaid DAG blast radius (visible by default)
5757
if (report.impact && report.impact.modifiedModels.length > 0) {
58-
const totalDownstream =
59-
report.impact.downstreamModels.length + report.impact.affectedExposures.length;
60-
if (totalDownstream > 0) {
58+
const filteredDownstream = report.impact.downstreamModels.filter(
59+
(d) => !/^(not_null|unique|accepted_values|relationships|dbt_utils|dbt_expectations)_/.test(d),
60+
);
61+
const visibleNodes = filteredDownstream.length + report.impact.affectedExposures.length;
62+
const testCount = report.impact.downstreamModels.length - filteredDownstream.length;
63+
64+
if (visibleNodes > 0) {
65+
// Has real downstream models — show Mermaid DAG
6166
sections.push(buildMermaidDAG(report.impact));
6267
sections.push("");
68+
} else if (testCount > 0) {
69+
// Only test nodes downstream — show text summary instead of empty graph
70+
sections.push(
71+
`### \uD83D\uDCCA Impact — ${report.impact.modifiedModels.join(", ")} (\uD83E\uDDEA ${testCount} tests depend on this model)`,
72+
);
73+
sections.push("");
6374
}
6475
}
6576

0 commit comments

Comments
 (0)