diff --git a/server-rs/crates/api-server/src/editor_project.rs b/server-rs/crates/api-server/src/editor_project.rs index 05a692290..9d6dd2861 100644 --- a/server-rs/crates/api-server/src/editor_project.rs +++ b/server-rs/crates/api-server/src/editor_project.rs @@ -2082,10 +2082,15 @@ pub(crate) async fn generate_editor_image_for_owner( resource: source_record.resource, asset: source_record.asset, project: completed_project, - warning: Some(editor_postprocess_fallback_warning_with_dimension( - "生成任务成功,后处理失败。", - dimension_warning.as_ref(), - )), + // 中文注释:原图安全降级同样要保留此前累积的告警(例如未知 style 的 + // unsupported-image-style),不能被后处理降级告警整条覆盖。 + warning: merge_editor_generation_warnings( + generation_warning, + Some(editor_postprocess_fallback_warning_with_dimension( + "生成任务成功,后处理失败。", + dimension_warning.as_ref(), + )), + ), }, )); } @@ -9285,6 +9290,26 @@ mod tests { ); } + #[test] + fn editor_image_generation_returns_never_drop_accumulated_warnings() { + let source = include_str!("editor_project.rs"); + // 中文注释:generation_warning 承载未知 style 的 unsupported-image-style 等 + // 累积告警,普通图片与角色生成的每一个返回点都必须经 merge 合并;任何 + // 直接的 `warning: Some(` 都会把此前累积的告警整条覆盖掉。 + for (start, end) in [ + ( + "pub(crate) async fn generate_editor_image_for_owner", + "fn editor_image_generation_billing_asset_kind", + ), + ( + "async fn generate_editor_icon_spritesheet_for_owner", + "fn slice_editor_icon_spritesheet_all", + ), + ] { + assert_function_not_contains(source, start, end, &["warning: Some("]); + } + } + #[test] fn pixel_art_degrade_paths_guard_postprocessed_delivery_dimensions() { let source = include_str!("editor_project.rs"); @@ -12229,7 +12254,11 @@ mod tests { "complete_editor_canvas_generation", "source_record.resource.as_ref()", "return Ok(json_success_body", - "warning: Some(editor_postprocess_fallback_warning", + // 中文注释:原图安全降级必须合并此前累积的告警,而不是整条覆盖, + // 同时仍要带上后处理降级告警本身。 + "warning: merge_editor_generation_warnings(", + "generation_warning", + "editor_postprocess_fallback_warning", ] { assert!( dimension_fallback_body.contains(snippet),