Skip to content

Commit 161051d

Browse files
committed
refactor: remove existing-tool improvements — scope to data-diff only
1 parent 6544ed9 commit 161051d

File tree

4 files changed

+5
-45
lines changed

4 files changed

+5
-45
lines changed

packages/opencode/src/altimate/tools/altimate-core-column-lineage.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,7 @@ function formatColumnLineage(data: Record<string, any>): string {
4747
if (data.column_dict && Object.keys(data.column_dict).length > 0) {
4848
lines.push("Column Mappings:")
4949
for (const [target, sources] of Object.entries(data.column_dict)) {
50-
const srcList = Array.isArray(sources)
51-
? sources
52-
.map((s: any) => {
53-
if (typeof s === "string") return s
54-
if (s && s.source_table && s.source_column) return `${s.source_table}.${s.source_column}`
55-
if (s && s.source) return String(s.source)
56-
return JSON.stringify(s)
57-
})
58-
.join(", ")
59-
: JSON.stringify(sources)
50+
const srcList = Array.isArray(sources) ? (sources as string[]).join(", ") : JSON.stringify(sources)
6051
lines.push(` ${target}${srcList}`)
6152
}
6253
lines.push("")

packages/opencode/src/altimate/tools/lineage-check.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,12 @@ export const LineageCheckTool = Tool.define("lineage_check", {
2020
}),
2121
async execute(args, ctx) {
2222
try {
23-
const raw = await Dispatcher.call("lineage.check", {
23+
const result = await Dispatcher.call("lineage.check", {
2424
sql: args.sql,
2525
dialect: args.dialect,
2626
schema_context: args.schema_context,
2727
})
2828

29-
// Guard against null/undefined/non-object responses
30-
if (raw == null || typeof raw !== "object") {
31-
return {
32-
title: "Lineage: ERROR",
33-
metadata: { success: false, error: "Unexpected response from lineage handler" },
34-
output: "Lineage check failed: unexpected response format.",
35-
}
36-
}
37-
const result = raw as LineageCheckResult
38-
3929
const data = (result.data ?? {}) as Record<string, any>
4030
if (result.error) {
4131
return {

packages/opencode/src/altimate/tools/schema-inspect.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,11 @@ export const SchemaInspectTool = Tool.define("schema_inspect", {
1515
}),
1616
async execute(args, ctx) {
1717
try {
18-
const raw = (await Dispatcher.call("schema.inspect", {
18+
const result = await Dispatcher.call("schema.inspect", {
1919
table: args.table,
2020
schema_name: args.schema_name,
2121
warehouse: args.warehouse,
22-
})) as any
23-
24-
// Surface dispatcher-level errors (e.g. { success: false, error: "..." })
25-
if (!raw || raw.success === false || raw.error) {
26-
const errorMsg = (raw?.error as string) ?? "Schema inspection failed"
27-
return {
28-
title: "Schema: ERROR",
29-
metadata: { columnCount: 0, rowCount: undefined, error: errorMsg },
30-
output: `Failed to inspect schema: ${errorMsg}\n\nEnsure the dispatcher is running and a warehouse connection is configured.`,
31-
}
32-
}
33-
const result = raw as SchemaInspectResult
22+
})
3423

3524
// altimate_change start — progressive disclosure suggestions
3625
let output = formatSchema(result)

packages/opencode/src/altimate/tools/sql-analyze.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,13 @@ export const SqlAnalyzeTool = Tool.define("sql_analyze", {
2626
async execute(args, ctx) {
2727
const hasSchema = !!(args.schema_path || (args.schema_context && Object.keys(args.schema_context).length > 0))
2828
try {
29-
const raw = await Dispatcher.call("sql.analyze", {
29+
const result = await Dispatcher.call("sql.analyze", {
3030
sql: args.sql,
3131
dialect: args.dialect,
3232
schema_path: args.schema_path,
3333
schema_context: args.schema_context,
3434
})
3535

36-
// Guard against null/undefined/non-object responses
37-
if (raw == null || typeof raw !== "object") {
38-
return {
39-
title: "Analyze: ERROR",
40-
metadata: { success: false, issueCount: 0, confidence: "unknown", dialect: args.dialect, has_schema: hasSchema, error: "Unexpected response from analysis handler" },
41-
output: "Analysis failed: unexpected response format.",
42-
}
43-
}
44-
const result = raw
45-
4636
// The handler returns success=true when analysis completes (issues are
4737
// reported via issues/issue_count). Only treat it as a failure when
4838
// there's an actual error (e.g. parse failure).

0 commit comments

Comments
 (0)