Skip to content

Commit 02fb1f6

Browse files
committed
fix(grafana): make Update Contact Point actually usable from the block
The new replace operation could never succeed. contactPointType and contactPointSettings were widened to cover it, but contactPointNameNew was left create-only — and the update maps `name` from that field, so the required parameter was never supplied. disableResolveMessage had the same gap, and it matters more than it looks: the update is a full replace, so a block-driven update was silently clearing resolve suppression on every contact point it touched. Both fields are now shown, and required where the API requires them. Also states a reason on each intentionally-unconstrained response field — Zod issue objects, alert query stages, notification settings, recording-rule config, and data-source health detail are all genuinely opaque, but that was left implicit.
1 parent d4b4e7d commit 02fb1f6

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

apps/sim/blocks/blocks/grafana.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,14 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
10051005
title: 'Contact Point Name',
10061006
type: 'short-input',
10071007
placeholder: 'Enter contact point name',
1008-
required: true,
1009-
condition: { field: 'operation', value: 'grafana_create_contact_point' },
1008+
required: {
1009+
field: 'operation',
1010+
value: ['grafana_create_contact_point', 'grafana_update_contact_point'],
1011+
},
1012+
condition: {
1013+
field: 'operation',
1014+
value: ['grafana_create_contact_point', 'grafana_update_contact_point'],
1015+
},
10101016
},
10111017
{
10121018
id: 'contactPointType',
@@ -1061,7 +1067,10 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
10611067
title: 'Disable Resolve Message',
10621068
type: 'switch',
10631069
mode: 'advanced',
1064-
condition: { field: 'operation', value: 'grafana_create_contact_point' },
1070+
condition: {
1071+
field: 'operation',
1072+
value: ['grafana_create_contact_point', 'grafana_update_contact_point'],
1073+
},
10651074
},
10661075
],
10671076
tools: {

apps/sim/lib/api/contracts/tools/grafana.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const grafanaUpdateDashboardResponseSchema = z.object({
3131
/** Absent on the auth short-circuit, `{}` on handled failures. */
3232
output: grafanaUpdateDashboardOutputSchema.partial().optional(),
3333
error: z.string().optional(),
34+
/** untyped-response: Zod issue objects, whose shape is Zod's, not ours to pin. */
3435
details: z.array(z.unknown()).optional(),
3536
})
3637

@@ -62,6 +63,7 @@ const grafanaUpdateAlertRuleOutputSchema = z.object({
6263
uid: z.string().nullable(),
6364
title: z.string().nullable(),
6465
condition: z.string().nullable(),
66+
/** untyped-response: alert query stages are opaque, data-source-specific payloads. */
6567
data: z.array(z.unknown()),
6668
updated: z.string().nullable(),
6769
noDataState: z.string().nullable(),
@@ -76,7 +78,9 @@ const grafanaUpdateAlertRuleOutputSchema = z.object({
7678
ruleGroup: z.string().nullable(),
7779
orgID: z.number().nullable(),
7880
provenance: z.string(),
81+
/** untyped-response: Grafana's notification settings shape is undocumented. */
7982
notification_settings: z.record(z.string(), z.unknown()).nullable(),
83+
/** untyped-response: recording-rule config is passed through opaquely. */
8084
record: z.record(z.string(), z.unknown()).nullable(),
8185
})
8286

@@ -85,6 +89,7 @@ export const grafanaUpdateAlertRuleResponseSchema = z.object({
8589
/** Absent on the auth short-circuit, `{}` on handled failures. */
8690
output: z.union([grafanaUpdateAlertRuleOutputSchema, z.object({})]).optional(),
8791
error: z.string().optional(),
92+
/** untyped-response: Zod issue objects, whose shape is Zod's, not ours to pin. */
8893
details: z.array(z.unknown()).optional(),
8994
})
9095

@@ -119,6 +124,7 @@ export const grafanaUpdateFolderResponseSchema = z.object({
119124
/** Absent on the auth short-circuit, `{}` on handled failures. */
120125
output: z.union([grafanaUpdateFolderOutputSchema, z.object({})]).optional(),
121126
error: z.string().optional(),
127+
/** untyped-response: Zod issue objects, whose shape is Zod's, not ours to pin. */
122128
details: z.array(z.unknown()).optional(),
123129
})
124130

@@ -132,13 +138,15 @@ const grafanaCheckDataSourceHealthBodySchema = z.object({
132138
const grafanaCheckDataSourceHealthOutputSchema = z.object({
133139
status: z.string(),
134140
message: z.string().nullable(),
141+
/** untyped-response: health detail is whatever the data source plugin chooses to attach. */
135142
details: z.unknown().optional(),
136143
})
137144

138145
export const grafanaCheckDataSourceHealthResponseSchema = z.object({
139146
success: z.boolean(),
140147
output: grafanaCheckDataSourceHealthOutputSchema.optional(),
141148
error: z.string().optional(),
149+
/** untyped-response: Zod issue objects, whose shape is Zod's, not ours to pin. */
142150
details: z.array(z.unknown()).optional(),
143151
})
144152

0 commit comments

Comments
 (0)