@@ -86,7 +86,7 @@ impl Job for TerraformWebhook {
8686 . map ( |n| {
8787 format ! (
8888 "- \\ [{}\\ ] {} (by {} at {})" ,
89- n. trigger, n. message, n. run_updated_by, n. run_updated_at
89+ n. trigger, n. message, n. run_updated_by. as_deref ( ) . unwrap_or ( "unknown" ) , n. run_updated_at
9090 )
9191 } )
9292 . collect :: < Vec < _ > > ( )
@@ -232,7 +232,7 @@ pub struct NotificationV1 {
232232 pub trigger : String ,
233233 pub run_status : String ,
234234 pub run_updated_at : chrono:: DateTime < chrono:: Utc > ,
235- pub run_updated_by : String ,
235+ pub run_updated_by : Option < String > ,
236236}
237237
238238#[ cfg( test) ]
@@ -287,4 +287,33 @@ mod tests {
287287 matches!( deserialized_v2, NotificationPayload :: Workplace { notification_configuration_id, .. } if notification_configuration_id == "nc_654321" )
288288 ) ;
289289 }
290+
291+ #[ test]
292+ fn test_deserialization_sampled ( ) {
293+ let payload = r#"{
294+ "payload_version":1,
295+ "notification_configuration_id":"nc-a9UxE3zM5k6YSNK3",
296+ "run_url":"https://app.terraform.io/app/xxx/yyy/runs/run-xboqtF5JxofL6a6A",
297+ "run_id":"run-xboqtF5JxofL6a6A",
298+ "run_message":"Merge pull request #100 from xxx/dependabot/terraform/hashicorp/azurerm-4.57.0",
299+ "run_created_at":"2025-12-18T19:13:53.000Z",
300+ "run_created_by":"dependabot[bot]",
301+ "workspace_id":"ws-qsGnTma1RXJ",
302+ "workspace_name":"infra",
303+ "organization_name":"xxx",
304+ "notifications":[
305+ {
306+ "message":"Run Planned and Finished",
307+ "trigger":"run:completed",
308+ "run_status":"planned_and_finished",
309+ "run_updated_at":"2025-12-18T19:15:00.000Z",
310+ "run_updated_by":null
311+ }
312+ ]
313+ }"# ;
314+ let deserialized: NotificationPayload = serde_json:: from_str ( payload) . unwrap ( ) ;
315+ assert ! (
316+ matches!( deserialized, NotificationPayload :: Standard { run_id, .. } if run_id == "run-xboqtF5JxofL6a6A" )
317+ ) ;
318+ }
290319}
0 commit comments