diff --git a/backend/crates/gateway-api/src/admin/system.rs b/backend/crates/gateway-api/src/admin/system.rs index 8016c2fdb..dda8bb698 100644 --- a/backend/crates/gateway-api/src/admin/system.rs +++ b/backend/crates/gateway-api/src/admin/system.rs @@ -201,6 +201,7 @@ struct RestartAcceptedView { #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] struct SystemUpdateEventView { + id: String, operation_id: Option, level: &'static str, step: Option, @@ -404,6 +405,7 @@ where impl From for SystemUpdateEventView { fn from(event: SystemUpdateEvent) -> Self { Self { + id: event.id, operation_id: event.operation_id, level: update_event_level_name(event.level), step: event.step, @@ -418,6 +420,7 @@ impl From for SystemUpdateEventView { impl SystemUpdateEventView { fn into_json(self) -> serde_json::Value { serde_json::json!({ + "id": self.id, "operationId": self.operation_id, "level": self.level, "step": self.step, diff --git a/backend/crates/gateway-api/tests/admin/system.rs b/backend/crates/gateway-api/tests/admin/system.rs index 3ff254d48..37803ab64 100644 --- a/backend/crates/gateway-api/tests/admin/system.rs +++ b/backend/crates/gateway-api/tests/admin/system.rs @@ -38,7 +38,7 @@ fn update_request_should_preserve_target_version_for_domain_validation() { } #[tokio::test] -async fn update_event_stream_should_preserve_download_progress_percent() { +async fn update_event_stream_should_preserve_event_id_and_download_progress_percent() { let fixture = AdminTestFixture::with_system(Arc::new(ProgressSystem)).await; fixture.auth.insert_session("valid-session"); let response = app(fixture.state()) @@ -57,6 +57,10 @@ async fn update_event_stream_should_preserve_download_progress_percent() { .expect("update event body"); let body = String::from_utf8(body.to_vec()).expect("UTF-8 event stream"); + assert!( + body.contains(r#""id":"update-progress-1""#), + "unexpected update event stream: {body}" + ); assert!( body.contains(r#""progressPercent":40"#), "unexpected update event stream: {body}"