Skip to content

Commit 3df3149

Browse files
committed
fix(grafana): surface route failures in transformResponse instead of masking them
The grafana update tools' transformResponse hardcoded success: true and dropped the route's error, so an upstream/validation failure (HTTP 200 with { success: false, error }) was reported to the workflow as a success. Forward data.success and data.error (matching the agiloft tools) so failures propagate as before the move to internal routes.
1 parent 1da299a commit 3df3149

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

apps/sim/tools/grafana/update_alert_rule.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ export const updateAlertRuleTool: ToolConfig<GrafanaUpdateAlertRuleParams, ToolR
161161
transformResponse: async (response: Response) => {
162162
const data = await response.json()
163163
return {
164-
success: true,
165-
output: data.output,
164+
success: data.success ?? true,
165+
output: data.output ?? {},
166+
...(data.error ? { error: data.error } : {}),
166167
}
167168
},
168169

apps/sim/tools/grafana/update_dashboard.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ export const updateDashboardTool: ToolConfig<GrafanaUpdateDashboardParams, ToolR
107107
transformResponse: async (response: Response) => {
108108
const data = await response.json()
109109
return {
110-
success: true,
111-
output: data.output,
110+
success: data.success ?? true,
111+
output: data.output ?? {},
112+
...(data.error ? { error: data.error } : {}),
112113
}
113114
},
114115

apps/sim/tools/grafana/update_folder.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ export const updateFolderTool: ToolConfig<GrafanaUpdateFolderParams, ToolRespons
5656
transformResponse: async (response: Response) => {
5757
const data = await response.json()
5858
return {
59-
success: true,
60-
output: data.output,
59+
success: data.success ?? true,
60+
output: data.output ?? {},
61+
...(data.error ? { error: data.error } : {}),
6162
}
6263
},
6364

0 commit comments

Comments
 (0)