修复角色尺寸恢复降级覆盖已累积生成告警
Project CI / Repository checks (pull_request) Successful in 50s
Project CI / Frontend tests (pull_request) Successful in 2m6s
Project CI / Native shell tests (pull_request) Successful in 2m35s
Project CI / Backend tests (pull_request) Successful in 3m35s

generate_editor_image_for_owner 的角色透明图尺寸恢复失败分支直接返回
warning: Some(...),没有合并 generation_warning,导致 style 为未知值时
契约承诺的 unsupported-image-style 告警在该降级路径上消失。

改为经 merge_editor_generation_warnings 合并,与该函数另外两个返回点一致。
新增结构断言固定"普通图片与图标生成的所有返回点都不得出现裸 warning: Some(",
并同步角色降级断言到合并后的形状。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 11:27:11 +00:00
parent a7d8bccec9
commit 49965ddd7e
@@ -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),