Skip to content

Commit b3ab743

Browse files
author
QA Autopilot
committed
fix: add missing async/await to graph children/parents commands (qa-autopilot)
Both children() and parents() in graph.ts call async adapter methods (getChildrenModels, getParentModels) without await, returning unresolved Promises. The callers in index.ts also miss the outer await, unlike all other switch cases. Effects: - JSON.stringify(Promise) produces {} — empty output - adapter.dispose() fires before the Promise settles, crashing the bridge
1 parent ce928a6 commit b3ab743

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

packages/dbt-tools/src/commands/graph.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import type { DBTProjectIntegrationAdapter } from "@altimateai/dbt-integration"
22

3-
export function children(adapter: DBTProjectIntegrationAdapter, args: string[]) {
3+
export async function children(adapter: DBTProjectIntegrationAdapter, args: string[]) {
44
const model = flag(args, "model")
55
if (!model) return { error: "Missing --model" }
6-
return adapter.getChildrenModels({ table: model })
6+
return await adapter.getChildrenModels({ table: model })
77
}
88

9-
export function parents(adapter: DBTProjectIntegrationAdapter, args: string[]) {
9+
export async function parents(adapter: DBTProjectIntegrationAdapter, args: string[]) {
1010
const model = flag(args, "model")
1111
if (!model) return { error: "Missing --model" }
12-
return adapter.getParentModels({ table: model })
12+
return await adapter.getParentModels({ table: model })
1313
}
1414

1515
function flag(args: string[], name: string): string | undefined {

packages/dbt-tools/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ async function main() {
172172
result = await (await import("./commands/columns")).values(adapter, rest)
173173
break
174174
case "children":
175-
result = (await import("./commands/graph")).children(adapter, rest)
175+
result = await (await import("./commands/graph")).children(adapter, rest)
176176
break
177177
case "parents":
178-
result = (await import("./commands/graph")).parents(adapter, rest)
178+
result = await (await import("./commands/graph")).parents(adapter, rest)
179179
break
180180
case "deps":
181181
result = await (await import("./commands/deps")).deps(adapter)

0 commit comments

Comments
 (0)